feat: Prune Paths + Fast ABI (#183)
* Cull paths which cannot improve price * fixes and rename * optimizations * disable ABI optimization for sampler * fix lint * use fastabi * Update to fastabi 0.0.2 * update packages * Fix NaN case * update to published packages * rebased * Update generated wrappers
This commit is contained in:
parent
5946d32a7d
commit
cd296b8767
@ -1,4 +1,17 @@
|
||||
[
|
||||
{
|
||||
"version": "6.8.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Prune paths which cannot improve the best path",
|
||||
"pr": 183
|
||||
},
|
||||
{
|
||||
"note": "Use FastABI for Sampler ABI encoding and decoding",
|
||||
"pr": 183
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "6.7.0",
|
||||
"changes": [
|
||||
|
@ -58,7 +58,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.26",
|
||||
"@0x/base-contract": "^6.3.2",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/contract-wrappers": "^13.15.0",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
@ -84,11 +84,12 @@
|
||||
"decimal.js": "^10.2.0",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"fast-abi": "^0.0.2",
|
||||
"heartbeats": "^5.0.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x/base-contract": "^6.3.2",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-exchange": "^3.2.28",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
|
@ -2,7 +2,8 @@ import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addre
|
||||
import { FillQuoteTransformerOrderType, LimitOrder } from '@0x/protocol-utils';
|
||||
import { BigNumber, providerUtils } from '@0x/utils';
|
||||
import Axios, { AxiosInstance } from 'axios';
|
||||
import { BlockParamLiteral, SupportedProvider, ZeroExProvider } from 'ethereum-types';
|
||||
import { BlockParamLiteral, MethodAbi, SupportedProvider, ZeroExProvider } from 'ethereum-types';
|
||||
import { FastABI } from 'fast-abi';
|
||||
import { Agent as HttpAgent } from 'http';
|
||||
import { Agent as HttpsAgent } from 'https';
|
||||
import * as _ from 'lodash';
|
||||
@ -122,12 +123,19 @@ export class SwapQuoter {
|
||||
{ block: BlockParamLiteral.Latest, overrides: defaultCodeOverrides },
|
||||
options.samplerOverrides,
|
||||
);
|
||||
const fastAbi = new FastABI(ERC20BridgeSamplerContract.ABI() as MethodAbi[]);
|
||||
const samplerContract = new ERC20BridgeSamplerContract(
|
||||
this._contractAddresses.erc20BridgeSampler,
|
||||
this.provider,
|
||||
{
|
||||
gas: samplerGasLimit,
|
||||
},
|
||||
{},
|
||||
undefined,
|
||||
{
|
||||
encodeInput: (fnName: string, values: any) => fastAbi.encodeInput(fnName, values),
|
||||
decodeOutput: (fnName: string, data: string) => fastAbi.decodeOutput(fnName, data),
|
||||
},
|
||||
);
|
||||
|
||||
this._marketOperationUtils = new MarketOperationUtils(
|
||||
|
@ -1025,7 +1025,7 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
||||
},
|
||||
[ERC20BridgeSource.Uniswap]: () => 90e3,
|
||||
[ERC20BridgeSource.LiquidityProvider]: fillData => {
|
||||
return (fillData as LiquidityProviderFillData).gasCost;
|
||||
return (fillData as LiquidityProviderFillData).gasCost || 100e3;
|
||||
},
|
||||
[ERC20BridgeSource.Eth2Dai]: () => 400e3,
|
||||
[ERC20BridgeSource.Kyber]: () => 450e3,
|
||||
|
@ -152,7 +152,7 @@ function dexSamplesToFills(
|
||||
const { source, fillData } = sample;
|
||||
const input = sample.input.minus(prevSample ? prevSample.input : 0);
|
||||
const output = sample.output.minus(prevSample ? prevSample.output : 0);
|
||||
const fee = fees[source] === undefined ? 0 : fees[source]!(sample.fillData);
|
||||
const fee = fees[source] === undefined ? 0 : fees[source]!(sample.fillData) || 0;
|
||||
let penalty = ZERO_AMOUNT;
|
||||
if (i === 0) {
|
||||
// Only the first fill in a DEX path incurs a penalty.
|
||||
|
@ -152,6 +152,17 @@ export class Path {
|
||||
return getRate(this.side, input, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the best possible rate this path can offer, given the fills.
|
||||
*/
|
||||
public bestRate(): BigNumber {
|
||||
const best = this.fills.reduce((prevRate, curr) => {
|
||||
const currRate = getRate(this.side, curr.input, curr.output);
|
||||
return prevRate.isLessThan(currRate) ? currRate : prevRate;
|
||||
}, new BigNumber(0));
|
||||
return best;
|
||||
}
|
||||
|
||||
public adjustedSlippage(maxRate: BigNumber): number {
|
||||
if (maxRate.eq(0)) {
|
||||
return 0;
|
||||
|
@ -4,7 +4,7 @@ import * as _ from 'lodash';
|
||||
import { MarketOperation } from '../../types';
|
||||
|
||||
import { DEFAULT_PATH_PENALTY_OPTS, Path, PathPenaltyOpts } from './path';
|
||||
import { Fill } from './types';
|
||||
import { ERC20BridgeSource, Fill } from './types';
|
||||
|
||||
// tslint:disable: prefer-for-of custom-no-magic-numbers completed-docs no-bitwise
|
||||
|
||||
@ -22,12 +22,13 @@ export async function findOptimalPathAsync(
|
||||
opts: PathPenaltyOpts = DEFAULT_PATH_PENALTY_OPTS,
|
||||
): Promise<Path | undefined> {
|
||||
// Sort fill arrays by descending adjusted completed rate.
|
||||
const sortedPaths = fillsToSortedPaths(fills, side, targetInput, opts);
|
||||
// Remove any paths which cannot impact the optimal path
|
||||
const sortedPaths = reducePaths(fillsToSortedPaths(fills, side, targetInput, opts), side);
|
||||
if (sortedPaths.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const rates = rateBySourcePathId(sortedPaths);
|
||||
let optimalPath = sortedPaths[0];
|
||||
const rates = rateBySourcePathId(side, fills, targetInput);
|
||||
for (const [i, path] of sortedPaths.slice(1).entries()) {
|
||||
optimalPath = mixPaths(side, optimalPath, path, targetInput, runLimit * RUN_LIMIT_DECAY_FACTOR ** i, rates);
|
||||
// Yield to event loop.
|
||||
@ -44,10 +45,47 @@ export function fillsToSortedPaths(
|
||||
opts: PathPenaltyOpts,
|
||||
): Path[] {
|
||||
const paths = fills.map(singleSourceFills => Path.create(side, singleSourceFills, targetInput, opts));
|
||||
const sortedPaths = paths.sort((a, b) => b.adjustedCompleteRate().comparedTo(a.adjustedCompleteRate()));
|
||||
const sortedPaths = paths.sort((a, b) => {
|
||||
const aRate = a.adjustedCompleteRate();
|
||||
const bRate = b.adjustedCompleteRate();
|
||||
// There is a case where the adjusted completed rate isn't sufficient for the desired amount
|
||||
// resulting in a NaN div by 0 (output)
|
||||
if (bRate.isNaN()) {
|
||||
return -1;
|
||||
}
|
||||
if (aRate.isNaN()) {
|
||||
return 1;
|
||||
}
|
||||
return bRate.comparedTo(aRate);
|
||||
});
|
||||
return sortedPaths;
|
||||
}
|
||||
|
||||
// Remove paths which have no impact on the optimal path
|
||||
export function reducePaths(sortedPaths: Path[], side: MarketOperation): Path[] {
|
||||
// Any path which has a min rate that is less than the best adjusted completed rate has no chance of improving
|
||||
// the overall route.
|
||||
const bestNonNativeCompletePath = sortedPaths.filter(
|
||||
p => p.isComplete() && p.fills[0].source !== ERC20BridgeSource.Native,
|
||||
)[0];
|
||||
|
||||
// If there is no complete path then just go ahead with the sorted paths
|
||||
// I.e if the token only exists on sources which cannot sell to infinity
|
||||
// or buys where X is greater than all the tokens available in the pools
|
||||
if (!bestNonNativeCompletePath) {
|
||||
return sortedPaths;
|
||||
}
|
||||
const bestNonNativeCompletePathAdjustedRate = bestNonNativeCompletePath.adjustedCompleteRate();
|
||||
if (!bestNonNativeCompletePathAdjustedRate.isGreaterThan(0)) {
|
||||
return sortedPaths;
|
||||
}
|
||||
|
||||
const filteredPaths = sortedPaths.filter(p =>
|
||||
p.bestRate().isGreaterThanOrEqualTo(bestNonNativeCompletePathAdjustedRate),
|
||||
);
|
||||
return filteredPaths;
|
||||
}
|
||||
|
||||
function mixPaths(
|
||||
side: MarketOperation,
|
||||
pathA: Path,
|
||||
@ -98,17 +136,6 @@ function mixPaths(
|
||||
return bestPath;
|
||||
}
|
||||
|
||||
function rateBySourcePathId(
|
||||
side: MarketOperation,
|
||||
fills: Fill[][],
|
||||
targetInput: BigNumber,
|
||||
): { [id: string]: BigNumber } {
|
||||
const flattenedFills = _.flatten(fills);
|
||||
const sourcePathIds = flattenedFills.filter(f => f.index === 0).map(f => f.sourcePathId);
|
||||
return Object.assign(
|
||||
{},
|
||||
...sourcePathIds.map(s => ({
|
||||
[s]: Path.create(side, flattenedFills.filter(f => f.sourcePathId === s), targetInput).adjustedRate(),
|
||||
})),
|
||||
);
|
||||
function rateBySourcePathId(paths: Path[]): { [id: string]: BigNumber } {
|
||||
return _.fromPairs(paths.map(p => [p.fills[0].sourcePathId, p.adjustedRate()]));
|
||||
}
|
||||
|
@ -141,6 +141,13 @@ export class SamplerOperations {
|
||||
orders: SignedNativeOrder[],
|
||||
exchangeAddress: string,
|
||||
): BatchedOperation<BigNumber[]> {
|
||||
// Skip checking empty or invalid orders on-chain, returning a constant
|
||||
if (orders.length === 0) {
|
||||
return SamplerOperations.constant<BigNumber[]>([]);
|
||||
}
|
||||
if (orders.length === 1 && orders[0].order.maker === NULL_ADDRESS) {
|
||||
return SamplerOperations.constant<BigNumber[]>([ZERO_AMOUNT]);
|
||||
}
|
||||
return new SamplerContractOperation({
|
||||
source: ERC20BridgeSource.Native,
|
||||
contract: this._samplerContract,
|
||||
@ -154,6 +161,13 @@ export class SamplerOperations {
|
||||
orders: SignedNativeOrder[],
|
||||
exchangeAddress: string,
|
||||
): BatchedOperation<BigNumber[]> {
|
||||
// Skip checking empty or invalid orders on-chain, returning a constant
|
||||
if (orders.length === 0) {
|
||||
return SamplerOperations.constant<BigNumber[]>([]);
|
||||
}
|
||||
if (orders.length === 1 && orders[0].order.maker === NULL_ADDRESS) {
|
||||
return SamplerOperations.constant<BigNumber[]>([ZERO_AMOUNT]);
|
||||
}
|
||||
return new SamplerContractOperation({
|
||||
source: ERC20BridgeSource.Native,
|
||||
contract: this._samplerContract,
|
||||
|
@ -299,6 +299,7 @@ describe('MarketOperationUtils tests', () => {
|
||||
[ERC20BridgeSource.Native]: createDecreasingRates(NUM_SAMPLES),
|
||||
[ERC20BridgeSource.Eth2Dai]: createDecreasingRates(NUM_SAMPLES),
|
||||
[ERC20BridgeSource.Uniswap]: createDecreasingRates(NUM_SAMPLES),
|
||||
[ERC20BridgeSource.Kyber]: createDecreasingRates(NUM_SAMPLES),
|
||||
};
|
||||
|
||||
interface FillDataBySource {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -528,6 +529,9 @@ export class BrokerContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as BrokerContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -914,7 +918,7 @@ export class BrokerContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = BrokerContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'Broker',
|
||||
@ -924,7 +928,7 @@ export class BrokerContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
BrokerContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -552,6 +553,9 @@ export class CoordinatorContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -966,7 +970,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = CoordinatorContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'Coordinator',
|
||||
@ -976,7 +980,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
CoordinatorContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -1569,6 +1570,9 @@ export class DevUtilsContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as DevUtilsContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -3371,7 +3375,7 @@ export class DevUtilsContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = DevUtilsContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'DevUtils',
|
||||
@ -3381,7 +3385,7 @@ export class DevUtilsContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
DevUtilsContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -400,6 +401,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -759,7 +763,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = ERC20TokenContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'ERC20Token',
|
||||
@ -769,7 +773,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ERC20TokenEventArgs, ERC20TokenEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -490,6 +491,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -1039,7 +1043,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = ERC721TokenContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'ERC721Token',
|
||||
@ -1049,7 +1053,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ERC721TokenEventArgs, ERC721TokenEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -3200,6 +3201,9 @@ export class ExchangeContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as ExchangeContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -6261,7 +6265,7 @@ export class ExchangeContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = ExchangeContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'Exchange',
|
||||
@ -6271,7 +6275,7 @@ export class ExchangeContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ExchangeEventArgs, ExchangeEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -752,6 +753,9 @@ export class ForwarderContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as ForwarderContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -1589,7 +1593,7 @@ export class ForwarderContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = ForwarderContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'Forwarder',
|
||||
@ -1599,7 +1603,7 @@ export class ForwarderContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ForwarderEventArgs, ForwarderEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -254,6 +255,9 @@ export class GodsUnchainedValidatorContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as GodsUnchainedValidatorContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -304,7 +308,7 @@ export class GodsUnchainedValidatorContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = GodsUnchainedValidatorContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'GodsUnchainedValidator',
|
||||
@ -314,7 +318,7 @@ export class GodsUnchainedValidatorContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
GodsUnchainedValidatorContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -323,6 +324,9 @@ export class IAssetDataContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as IAssetDataContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -758,7 +762,7 @@ export class IAssetDataContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = IAssetDataContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'IAssetData',
|
||||
@ -768,7 +772,7 @@ export class IAssetDataContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
IAssetDataContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -304,6 +305,9 @@ export class ILiquidityProviderContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as ILiquidityProviderContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -477,7 +481,7 @@ export class ILiquidityProviderContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = ILiquidityProviderContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'ILiquidityProvider',
|
||||
@ -487,7 +491,7 @@ export class ILiquidityProviderContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
ILiquidityProviderContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -468,6 +469,9 @@ export class ITransformERC20Contract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as ITransformERC20Contract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -1082,7 +1086,7 @@ export class ITransformERC20Contract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = ITransformERC20Contract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'ITransformERC20',
|
||||
@ -1092,7 +1096,7 @@ export class ITransformERC20Contract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ITransformERC20EventArgs, ITransformERC20Events>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -3358,6 +3359,9 @@ export class IZeroExContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as IZeroExContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -7338,7 +7342,7 @@ export class IZeroExContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = IZeroExContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'IZeroEx',
|
||||
@ -7348,7 +7352,7 @@ export class IZeroExContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<IZeroExEventArgs, IZeroExEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -226,6 +227,9 @@ export class MaximumGasPriceContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as MaximumGasPriceContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -298,7 +302,7 @@ export class MaximumGasPriceContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = MaximumGasPriceContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'MaximumGasPrice',
|
||||
@ -308,7 +312,7 @@ export class MaximumGasPriceContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
MaximumGasPriceContract.ABI().forEach((item, index) => {
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -1669,6 +1670,9 @@ export class StakingContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as StakingContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -3731,7 +3735,7 @@ export class StakingContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = StakingContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'Staking',
|
||||
@ -3741,7 +3745,7 @@ export class StakingContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<StakingEventArgs, StakingEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -796,6 +797,9 @@ export class StakingProxyContract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as StakingProxyContract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -1745,7 +1749,7 @@ export class StakingProxyContract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = StakingProxyContract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'StakingProxy',
|
||||
@ -1755,7 +1759,7 @@ export class StakingProxyContract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<StakingProxyEventArgs, StakingProxyEvents>(
|
||||
|
@ -3,6 +3,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
AwaitTransactionSuccessOpts,
|
||||
EncoderOverrides,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
SendTransactionOpts,
|
||||
@ -524,6 +525,9 @@ export class WETH9Contract extends BaseContract {
|
||||
}
|
||||
|
||||
public getABIDecodedReturnData<T>(methodName: string, callData: string): T {
|
||||
if (this._encoderOverrides.decodeOutput) {
|
||||
return this._encoderOverrides.decodeOutput(methodName, callData);
|
||||
}
|
||||
const functionSignature = this.getFunctionSignature(methodName);
|
||||
const self = (this as any) as WETH9Contract;
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
@ -1028,7 +1032,7 @@ export class WETH9Contract extends BaseContract {
|
||||
txDefaults?: Partial<TxData>,
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
deployedBytecode: string | undefined = WETH9Contract.deployedBytecode,
|
||||
encodingRules?: EncodingRules,
|
||||
encoderOverrides?: Partial<EncoderOverrides>,
|
||||
) {
|
||||
super(
|
||||
'WETH9',
|
||||
@ -1038,7 +1042,7 @@ export class WETH9Contract extends BaseContract {
|
||||
txDefaults,
|
||||
logDecodeDependencies,
|
||||
deployedBytecode,
|
||||
encodingRules,
|
||||
encoderOverrides,
|
||||
);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<WETH9EventArgs, WETH9Events>(
|
||||
|
@ -3,6 +3,7 @@ export {
|
||||
ContractEvent,
|
||||
ContractFunctionObj,
|
||||
ContractTxFunctionObj,
|
||||
EncoderOverrides,
|
||||
SendTransactionOpts,
|
||||
SubscriptionErrors,
|
||||
} from '@0x/base-contract';
|
||||
|
Loading…
x
Reference in New Issue
Block a user