// 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'filled'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public batchFillOrders = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
takerAssetFillAmounts,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
takerAssetFillAmounts,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'batchFillOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public cancelled = {
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<boolean
> {
const self = this as any as ExchangeContract;
const functionSignature = 'cancelled(bytes32)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'cancelled'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public preSign = {
async sendTransactionAsync(
hash: string,
signerAddress: string,
signature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[hash,
signerAddress,
signature
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
signerAddress,
signature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'preSign'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public matchOrders = {
async sendTransactionAsync(
leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
leftSignature: string,
rightSignature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[leftOrder,
rightOrder,
leftSignature,
rightSignature
] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
rightOrder,
leftSignature,
rightSignature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public fillOrderNoThrow = {
async sendTransactionAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
signature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[order,
takerAssetFillAmount,
signature
] = BaseContract._formatABIDataItemList(inputAbi, [order,
takerAssetFillAmount,
signature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'fillOrderNoThrow'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public assetProxies = {
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'assetProxies(bytes4)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public batchCancelOrders = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders
] = BaseContract._formatABIDataItemList(inputAbi, [orders
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'batchCancelOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public batchFillOrKillOrders = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
takerAssetFillAmounts,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
takerAssetFillAmounts,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'batchFillOrKillOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public cancelOrdersUpTo = {
async sendTransactionAsync(
targetOrderEpoch: BigNumber,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[targetOrderEpoch
] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public batchFillOrdersNoThrow = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
takerAssetFillAmounts,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
takerAssetFillAmounts,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'batchFillOrdersNoThrow'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public getAssetProxy = {
async callAsync(
assetProxyId: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'getAssetProxy(bytes4)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[assetProxyId
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public transactions = {
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<boolean
> {
const self = this as any as ExchangeContract;
const functionSignature = 'transactions(bytes32)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public fillOrKillOrder = {
async sendTransactionAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
signature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[order,
takerAssetFillAmount,
signature
] = BaseContract._formatABIDataItemList(inputAbi, [order,
takerAssetFillAmount,
signature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'fillOrKillOrder'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public setSignatureValidatorApproval = {
async sendTransactionAsync(
validatorAddress: string,
approval: boolean,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[validatorAddress,
approval
] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
approval
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public allowedValidators = {
async callAsync(
index_0: string,
index_1: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<boolean
> {
const self = this as any as ExchangeContract;
const functionSignature = 'allowedValidators(address,address)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0,
index_1
] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
index_1
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public marketSellOrders = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmount: BigNumber,
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
takerAssetFillAmount,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
takerAssetFillAmount,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'marketSellOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public getOrdersInfo = {
async callAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>
> {
const self = this as any as ExchangeContract;
const functionSignature = 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[orders
] = BaseContract._formatABIDataItemList(inputAbi, [orders
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'getOrdersInfo'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public preSigned = {
async callAsync(
index_0: string,
index_1: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<boolean
> {
const self = this as any as ExchangeContract;
const functionSignature = 'preSigned(bytes32,address)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0,
index_1
] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
index_1
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'preSigned'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public owner = {
async callAsync(
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'owner()';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public isValidSignature = {
async callAsync(
hash: string,
signerAddress: string,
signature: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<boolean
> {
const self = this as any as ExchangeContract;
const functionSignature = 'isValidSignature(bytes32,address,bytes)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[hash,
signerAddress,
signature
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
signerAddress,
signature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public marketBuyOrdersNoThrow = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
makerAssetFillAmount,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
makerAssetFillAmount,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersNoThrow'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public fillOrder = {
async sendTransactionAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
signature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[order,
takerAssetFillAmount,
signature
] = BaseContract._formatABIDataItemList(inputAbi, [order,
takerAssetFillAmount,
signature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public executeTransaction = {
async sendTransactionAsync(
salt: BigNumber,
signerAddress: string,
data: string,
signature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[salt,
signerAddress,
data,
signature
] = BaseContract._formatABIDataItemList(inputAbi, [salt,
signerAddress,
data,
signature
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public registerAssetProxy = {
async sendTransactionAsync(
assetProxy: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[assetProxy
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public getOrderInfo = {
async callAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}
> {
const self = this as any as ExchangeContract;
const functionSignature = 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'getOrderInfo'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public cancelOrder = {
async sendTransactionAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'cancelOrder'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public orderEpoch = {
async callAsync(
index_0: string,
index_1: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<BigNumber
> {
const self = this as any as ExchangeContract;
const functionSignature = 'orderEpoch(address,address)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[index_0,
index_1
] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
index_1
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'orderEpoch'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public ZRX_ASSET_DATA = {
async callAsync(
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'ZRX_ASSET_DATA()';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'ZRX_ASSET_DATA'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public marketSellOrdersNoThrow = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmount: BigNumber,
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
takerAssetFillAmount,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
takerAssetFillAmount,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersNoThrow'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public EIP712_DOMAIN_HASH = {
async callAsync(
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'EIP712_DOMAIN_HASH()';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public marketBuyOrders = {
async sendTransactionAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[orders,
makerAssetFillAmount,
signatures
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
makerAssetFillAmount,
signatures
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'marketBuyOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public currentContextAddress = {
async callAsync(
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'currentContextAddress()';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public transferOwnership = {
async sendTransactionAsync(
newOwner: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
const 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 inputAbi = self._lookupAbi(functionSignature).inputs;
[newOwner
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray;
},
};
public VERSION = {
async callAsync(
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as ExchangeContract;
const functionSignature = 'VERSION()';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
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);
const decodingRules = {structsAsObjects: false};
let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules);
const outputAbi = (_.find(self.abi, {name: 'VERSION'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | 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