Updated all instances of deployFrom0xArtifactAsync
This commit is contained in:
parent
df746c5ff4
commit
d8cf9d54aa
@ -37,6 +37,7 @@ describe('Authorizable', () => {
|
||||
artifacts.MixinAuthorizable,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
@ -23,7 +23,7 @@ import { LogWithDecodedArgs } from 'ethereum-types';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ERC1155ProxyContract, ERC1155ProxyWrapper } from '../src';
|
||||
import { artifacts, ERC1155ProxyContract, ERC1155ProxyWrapper } from '../src';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@ -89,6 +89,7 @@ describe('ERC1155Proxy', () => {
|
||||
erc1155Artifacts.DummyERC1155Receiver,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
receiverContract = erc1155Receiver.address;
|
||||
await erc1155ProxyWrapper.setBalancesAndAllowancesAsync();
|
||||
|
@ -101,6 +101,7 @@ describe('Asset Transfer Proxies', () => {
|
||||
artifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
// Configure ERC20Proxy
|
||||
@ -173,6 +174,7 @@ describe('Asset Transfer Proxies', () => {
|
||||
erc20Artifacts.DummyNoReturnERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@ -182,6 +184,7 @@ describe('Asset Transfer Proxies', () => {
|
||||
erc20Artifacts.DummyMultipleReturnERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@ -224,6 +227,7 @@ describe('Asset Transfer Proxies', () => {
|
||||
erc721Artifacts.DummyERC721Receiver,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
await erc721Wrapper.setBalancesAndAllowancesAsync();
|
||||
|
@ -41,12 +41,14 @@ describe('StaticCallProxy', () => {
|
||||
artifacts.StaticCallProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
staticCallProxy = new IAssetProxyContract(staticCallProxyWithoutTransferFrom.address, provider, txDefaults);
|
||||
staticCallTarget = await TestStaticCallTargetContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestStaticCallTarget,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
@ -54,6 +54,7 @@ export class ERC1155ProxyWrapper {
|
||||
erc1155Artifacts.ERC1155Mintable,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const erc1155Wrapper = new Erc1155Wrapper(erc1155Contract, this._provider, this._contractOwnerAddress);
|
||||
this._dummyTokenWrappers.push(erc1155Wrapper);
|
||||
@ -69,6 +70,7 @@ export class ERC1155ProxyWrapper {
|
||||
artifacts.ERC1155Proxy,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
|
||||
return this._proxyContract;
|
||||
|
@ -37,6 +37,7 @@ export class ERC20Wrapper {
|
||||
erc20Artifacts.DummyERC20Token,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
decimals,
|
||||
@ -51,6 +52,7 @@ export class ERC20Wrapper {
|
||||
artifacts.ERC20Proxy,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
|
||||
return this._proxyContract;
|
||||
|
@ -29,6 +29,7 @@ export class ERC721Wrapper {
|
||||
erc721Artifacts.DummyERC721Token,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
),
|
||||
@ -41,6 +42,7 @@ export class ERC721Wrapper {
|
||||
artifacts.ERC721Proxy,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
|
||||
return this._proxyContract;
|
||||
|
@ -74,6 +74,7 @@ describe('Coordinator tests', () => {
|
||||
exchangeArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
assetDataUtils.encodeERC20AssetData(zrxToken.address),
|
||||
);
|
||||
|
||||
@ -91,6 +92,7 @@ describe('Coordinator tests', () => {
|
||||
artifacts.Coordinator,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
);
|
||||
|
||||
|
@ -25,6 +25,7 @@ describe('Libs tests', () => {
|
||||
artifacts.Coordinator,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchangeAddress,
|
||||
);
|
||||
});
|
||||
|
@ -44,6 +44,7 @@ describe('Mixins tests', () => {
|
||||
artifacts.Coordinator,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchangeAddress,
|
||||
);
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
|
@ -24,6 +24,7 @@ export class CoordinatorRegistryWrapper {
|
||||
artifacts.CoordinatorRegistry,
|
||||
this._provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
if (this._coordinatorRegistryContract === undefined) {
|
||||
throw new Error(`Failed to deploy Coordinator Registry contract.`);
|
||||
|
@ -92,6 +92,7 @@ describe('LibAssetData', () => {
|
||||
exchangeArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.NULL_BYTES,
|
||||
);
|
||||
|
||||
@ -99,26 +100,31 @@ describe('LibAssetData', () => {
|
||||
proxyArtifacts.ERC20Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.ERC721Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
erc1155Proxy = await ERC1155ProxyContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.ERC1155Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
multiAssetProxy = await MultiAssetProxyContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.StaticCallProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address);
|
||||
@ -131,6 +137,7 @@ describe('LibAssetData', () => {
|
||||
artifacts.LibAssetData,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
);
|
||||
|
||||
@ -138,6 +145,7 @@ describe('LibAssetData', () => {
|
||||
proxyArtifacts.TestStaticCallTarget,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
[tokenOwnerAddress] = await web3Wrapper.getAvailableAddressesAsync();
|
||||
@ -146,6 +154,7 @@ describe('LibAssetData', () => {
|
||||
erc20Artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
'Dummy',
|
||||
'DUM',
|
||||
new BigNumber(1),
|
||||
@ -156,6 +165,7 @@ describe('LibAssetData', () => {
|
||||
erc721Artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
'Dummy',
|
||||
'DUM',
|
||||
);
|
||||
@ -172,6 +182,7 @@ describe('LibAssetData', () => {
|
||||
erc1155Artifacts.ERC1155Mintable,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
const logDecoder = new LogDecoder(web3Wrapper, erc1155Artifacts);
|
||||
|
@ -37,6 +37,7 @@ describe('LibTransactionDecoder', () => {
|
||||
artifacts.LibTransactionDecoder,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
|
@ -83,6 +83,7 @@ describe('OrderValidationUtils', () => {
|
||||
exchangeArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
zrxAssetData,
|
||||
);
|
||||
|
||||
@ -90,6 +91,7 @@ describe('OrderValidationUtils', () => {
|
||||
proxyArtifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
||||
@ -102,6 +104,7 @@ describe('OrderValidationUtils', () => {
|
||||
artifacts.DevUtils,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
zrxAssetData,
|
||||
);
|
||||
|
@ -60,11 +60,13 @@ describe('ERC1155Token', () => {
|
||||
artifacts.ERC1155Mintable,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
erc1155Receiver = await DummyERC1155ReceiverContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyERC1155Receiver,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
receiver = erc1155Receiver.address;
|
||||
// create wrapper & mint erc1155 tokens
|
||||
|
@ -37,6 +37,7 @@ describe('UnlimitedAllowanceToken', () => {
|
||||
artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
|
@ -33,10 +33,15 @@ describe('EtherToken', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
account = accounts[0];
|
||||
|
||||
etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, {
|
||||
etherToken = await WETH9Contract.deployFrom0xArtifactAsync(
|
||||
artifacts.WETH9,
|
||||
provider,
|
||||
{
|
||||
gasPrice,
|
||||
...txDefaults,
|
||||
});
|
||||
},
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
|
@ -26,7 +26,12 @@ describe('ZRXToken', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
owner = accounts[0];
|
||||
spender = accounts[1];
|
||||
zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRXToken, provider, txDefaults);
|
||||
zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.ZRXToken,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
MAX_UINT = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
@ -48,6 +48,7 @@ describe('ERC721Token', () => {
|
||||
artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
@ -55,6 +56,7 @@ describe('ERC721Token', () => {
|
||||
artifacts.DummyERC721Receiver,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
logDecoder = new LogDecoder(web3Wrapper, artifacts);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
@ -176,6 +178,7 @@ describe('ERC721Token', () => {
|
||||
artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
@ -190,6 +193,7 @@ describe('ERC721Token', () => {
|
||||
artifacts.InvalidERC721Receiver,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const from = owner;
|
||||
const to = invalidErc721Receiver.address;
|
||||
@ -237,6 +241,7 @@ describe('ERC721Token', () => {
|
||||
artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
@ -251,6 +256,7 @@ describe('ERC721Token', () => {
|
||||
artifacts.InvalidERC721Receiver,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const from = owner;
|
||||
const to = invalidErc721Receiver.address;
|
||||
|
@ -32,6 +32,7 @@ const DECIMALS_DEFAULT = 18;
|
||||
const MAX_WETH_FILL_PERCENTAGE = 95;
|
||||
|
||||
describe(ContractName.Forwarder, () => {
|
||||
const dependencyArtifacts = { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts };
|
||||
let makerAddress: string;
|
||||
let owner: string;
|
||||
let takerAddress: string;
|
||||
@ -88,7 +89,12 @@ describe(ContractName.Forwarder, () => {
|
||||
const erc721Balances = await erc721Wrapper.getBalancesAsync();
|
||||
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
|
||||
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults);
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(
|
||||
erc20Artifacts.WETH9,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
weth = new DummyERC20TokenContract(wethContract.address, provider);
|
||||
erc20Wrapper.addDummyTokenContract(weth);
|
||||
|
||||
@ -98,6 +104,7 @@ describe(ContractName.Forwarder, () => {
|
||||
exchangeArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
zrxAssetData,
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
|
||||
@ -131,6 +138,7 @@ describe(ContractName.Forwarder, () => {
|
||||
artifacts.Forwarder,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
exchangeInstance.address,
|
||||
zrxAssetData,
|
||||
wethAssetData,
|
||||
@ -169,6 +177,7 @@ describe(ContractName.Forwarder, () => {
|
||||
exchangeArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
zrxAssetData,
|
||||
);
|
||||
return expectContractCreationFailedAsync(
|
||||
@ -176,6 +185,7 @@ describe(ContractName.Forwarder, () => {
|
||||
artifacts.Forwarder,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
exchangeInstance.address,
|
||||
zrxAssetData,
|
||||
wethAssetData,
|
||||
|
@ -35,7 +35,7 @@ describe('Exchange libs', () => {
|
||||
before(async () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
const makerAddress = accounts[0];
|
||||
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
||||
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults, artifacts);
|
||||
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
|
@ -119,11 +119,13 @@ describe('Exchange core', () => {
|
||||
proxyArtifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.StaticCallProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
const numDummyErc20ToDeploy = 3;
|
||||
[erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
|
||||
@ -354,6 +356,7 @@ describe('Exchange core', () => {
|
||||
erc20Artifacts.DummyNoReturnERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@ -384,7 +387,7 @@ describe('Exchange core', () => {
|
||||
const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
|
||||
const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
|
||||
|
||||
const txReceipt = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
|
||||
await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
|
||||
|
||||
const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
|
||||
const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
|
||||
@ -1479,6 +1482,7 @@ describe('Exchange core', () => {
|
||||
proxyArtifacts.TestStaticCallTarget,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
});
|
||||
it('should revert if the staticcall is unsuccessful', async () => {
|
||||
|
@ -137,6 +137,7 @@ describe('AssetProxyDispatcher', () => {
|
||||
proxyArtifacts.ERC20Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
// Register new ERC20 Transfer Proxy contract
|
||||
return expectTransactionFailedAsync(
|
||||
|
@ -1,25 +1,17 @@
|
||||
import { artifacts as erc1155Artifacts } from '@0x/contracts-erc1155';
|
||||
import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
|
||||
import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
|
||||
import {
|
||||
FillResults,
|
||||
formatters,
|
||||
OrderInfo,
|
||||
orderUtils,
|
||||
Web3ProviderEngine,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { FillResults, formatters, OrderInfo, orderUtils, Web3ProviderEngine } from '@0x/contracts-test-utils';
|
||||
import { SignedOrder, SignedZeroExTransaction } from '@0x/types';
|
||||
import { AbiEncoder, BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { MethodAbi, TransactionReceiptWithDecodedLogs, ZeroExProvider } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts, ExchangeContract } from '../../src';
|
||||
import { ExchangeContract } from '../../src';
|
||||
|
||||
import { AbiDecodedFillOrderData } from './types';
|
||||
|
||||
export class ExchangeWrapper {
|
||||
private readonly _exchange: ExchangeContract;
|
||||
// tslint:disable no-unused-variable
|
||||
private readonly _web3Wrapper: Web3Wrapper;
|
||||
constructor(exchangeContract: ExchangeContract, provider: Web3ProviderEngine | ZeroExProvider) {
|
||||
this._exchange = exchangeContract;
|
||||
@ -186,7 +178,9 @@ export class ExchangeWrapper {
|
||||
assetProxyAddress: string,
|
||||
from: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const txReceipt = await this._exchange.registerAssetProxy.awaitTransactionSuccessAsync(assetProxyAddress, { from });
|
||||
const txReceipt = await this._exchange.registerAssetProxy.awaitTransactionSuccessAsync(assetProxyAddress, {
|
||||
from,
|
||||
});
|
||||
return txReceipt;
|
||||
}
|
||||
public async executeTransactionAsync(
|
||||
|
@ -137,6 +137,7 @@ export async function fillOrderCombinatorialUtilsFactoryAsync(
|
||||
libsArtifacts.TestLibs,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
|
||||
const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils(
|
||||
|
@ -130,6 +130,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
zrxAssetData,
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
|
||||
@ -148,6 +149,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
||||
artifacts.BalanceThresholdFilter,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchangeInstance.address,
|
||||
erc721BalanceThresholdAsset.address,
|
||||
erc721alanceThreshold,
|
||||
@ -157,6 +159,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
||||
artifacts.BalanceThresholdFilter,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchangeInstance.address,
|
||||
erc20BalanceThresholdAsset.address,
|
||||
erc20BalanceThreshold,
|
||||
|
@ -82,7 +82,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
const erc721Balances = await erc721Wrapper.getBalancesAsync();
|
||||
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
|
||||
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults, artifacts);
|
||||
erc20Wrapper.addDummyTokenContract(wethContract as any);
|
||||
|
||||
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
|
||||
@ -90,6 +90,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
zrxAssetData,
|
||||
);
|
||||
const exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
|
||||
@ -107,6 +108,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
artifacts.DutchAuction,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchangeInstance.address,
|
||||
);
|
||||
dutchAuctionContract = new DutchAuctionContract(dutchAuctionInstance.address, provider);
|
||||
|
@ -103,12 +103,14 @@ describe('OrderMatcher', () => {
|
||||
proxyArtifacts.ERC721Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
// Depoy exchange
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
assetDataUtils.encodeERC20AssetData(zrxToken.address),
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||
@ -126,6 +128,7 @@ describe('OrderMatcher', () => {
|
||||
artifacts.OrderMatcher,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
);
|
||||
// Set default addresses
|
||||
@ -198,6 +201,7 @@ describe('OrderMatcher', () => {
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.NULL_BYTES,
|
||||
);
|
||||
return expectContractCreationFailedAsync(
|
||||
@ -205,6 +209,7 @@ describe('OrderMatcher', () => {
|
||||
artifacts.OrderMatcher,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchangeInstance.address,
|
||||
) as any) as sendTransactionResult,
|
||||
RevertReason.UnregisteredAssetProxy,
|
||||
@ -727,6 +732,7 @@ describe('OrderMatcher', () => {
|
||||
erc721Artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
@ -772,6 +778,7 @@ describe('OrderMatcher', () => {
|
||||
erc721Artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
@ -789,6 +796,7 @@ describe('OrderMatcher', () => {
|
||||
erc721Artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
|
@ -61,17 +61,20 @@ describe('AssetProxyOwner', () => {
|
||||
proxyArtifacts.MixinAuthorizable,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
erc721Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.MixinAuthorizable,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const defaultAssetProxyContractAddresses: string[] = [];
|
||||
testAssetProxyOwner = await TestAssetProxyOwnerContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestAssetProxyOwner,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
defaultAssetProxyContractAddresses,
|
||||
REQUIRED_APPROVALS,
|
||||
@ -105,6 +108,7 @@ describe('AssetProxyOwner', () => {
|
||||
artifacts.AssetProxyOwner,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
assetProxyContractAddresses,
|
||||
REQUIRED_APPROVALS,
|
||||
@ -122,6 +126,7 @@ describe('AssetProxyOwner', () => {
|
||||
artifacts.AssetProxyOwner,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
assetProxyContractAddresses,
|
||||
REQUIRED_APPROVALS,
|
||||
|
@ -66,6 +66,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
REQUIRED_APPROVALS,
|
||||
secondsTimeLocked,
|
||||
@ -81,6 +82,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
REQUIRED_APPROVALS,
|
||||
secondsTimeLocked,
|
||||
@ -135,6 +137,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
REQUIRED_APPROVALS,
|
||||
secondsTimeLocked,
|
||||
@ -198,6 +201,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
artifacts.TestRejectEther,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const data = constants.NULL_BYTES;
|
||||
const value = new BigNumber(10);
|
||||
@ -234,6 +238,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
REQUIRED_APPROVALS,
|
||||
secondsTimeLocked,
|
||||
@ -308,6 +313,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
REQUIRED_APPROVALS,
|
||||
SECONDS_TIME_LOCKED,
|
||||
|
@ -28,6 +28,7 @@ describe('LibAddressArray', () => {
|
||||
artifacts.TestLibAddressArray,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
|
@ -68,7 +68,12 @@ describe('LibBytes', () => {
|
||||
testAddress = accounts[1];
|
||||
testAddressB = accounts[2];
|
||||
// Deploy LibBytes
|
||||
libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync(artifacts.TestLibBytes, provider, txDefaults);
|
||||
libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestLibBytes,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
// Verify lengths of test data
|
||||
const byteArrayShorterThan32BytesLength = ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength;
|
||||
expect(byteArrayShorterThan32BytesLength).to.be.lessThan(32);
|
||||
|
@ -24,6 +24,7 @@ describe('Libs', () => {
|
||||
artifacts.TestConstants,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const isValid = await testConstants.assertValidZrxAssetData.callAsync();
|
||||
expect(isValid).to.be.equal(true);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
@ -33,7 +35,8 @@ export class CoordinatorContract extends BaseContract {
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signature', signature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -44,8 +47,10 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -54,25 +59,26 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(hash: string, signature: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
hash: string,
|
||||
signature: string,
|
||||
): string {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signature', signature);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [
|
||||
hash,
|
||||
signature,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -82,7 +88,9 @@ export class CoordinatorContract extends BaseContract {
|
||||
transaction: {salt: BigNumber;signerAddress: string;data: string},
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -91,9 +99,8 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -103,38 +110,35 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(transaction: { salt: BigNumber; signerAddress: string; data: string }): string {
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getTransactionHash((uint256,address,bytes))',
|
||||
[transaction],
|
||||
);
|
||||
getABIEncodedTransactionData(
|
||||
transaction: {salt: BigNumber;signerAddress: string;data: string},
|
||||
): string {
|
||||
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getCoordinatorApprovalHash = {
|
||||
async callAsync(
|
||||
approval: {
|
||||
txOrigin: string;
|
||||
transactionHash: string;
|
||||
transactionSignature: string;
|
||||
approvalExpirationTimeSeconds: BigNumber;
|
||||
},
|
||||
approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber},
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -143,11 +147,9 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))',
|
||||
[approval],
|
||||
);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -156,29 +158,24 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(approval: {
|
||||
txOrigin: string;
|
||||
transactionHash: string;
|
||||
transactionSignature: string;
|
||||
approvalExpirationTimeSeconds: BigNumber;
|
||||
}): string {
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))',
|
||||
[approval],
|
||||
);
|
||||
getABIEncodedTransactionData(
|
||||
approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber},
|
||||
): string {
|
||||
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -191,21 +188,18 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalSignatures: string[],
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
[
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
],
|
||||
);
|
||||
approvalSignatures
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -219,7 +213,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
approvalSignatures
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
@ -239,19 +233,18 @@ export class CoordinatorContract extends BaseContract {
|
||||
pollingIntervalMs?: number,
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const txHashPromise = self.executeTransaction.sendTransactionAsync(
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
txData,
|
||||
);
|
||||
approvalSignatures
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -272,21 +265,18 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalSignatures: string[],
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
[
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
],
|
||||
);
|
||||
approvalSignatures
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -310,7 +300,9 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalSignatures: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
@ -323,17 +315,13 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
[
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
],
|
||||
);
|
||||
approvalSignatures
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -342,17 +330,14 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
@ -363,26 +348,27 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
): string {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
[
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
],
|
||||
);
|
||||
approvalSignatures
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public EIP712_EXCHANGE_DOMAIN_HASH = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -391,7 +377,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -401,20 +387,20 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -428,7 +414,9 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalSignatures: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
@ -441,17 +429,13 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
[
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
],
|
||||
);
|
||||
approvalSignatures
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -460,17 +444,14 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
@ -481,21 +462,18 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
): string {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])',
|
||||
[
|
||||
transaction,
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin.toLowerCase(),
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures,
|
||||
],
|
||||
);
|
||||
approvalSignatures
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -504,21 +482,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
data: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<
|
||||
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;
|
||||
}>
|
||||
): Promise<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}>
|
||||
> {
|
||||
assert.isString('data', data);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -529,8 +493,9 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -539,42 +504,33 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<
|
||||
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;
|
||||
}>
|
||||
const result = abiEncoder.strictDecodeReturnValue<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}>
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(data: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
data: string,
|
||||
): string {
|
||||
assert.isString('data', data);
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public EIP712_COORDINATOR_DOMAIN_HASH = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -583,7 +539,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -593,20 +549,20 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as CoordinatorContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -615,6 +571,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -628,13 +585,16 @@ export class CoordinatorContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
@ -645,14 +605,17 @@ export class CoordinatorContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange] = BaseContract._formatABIDataItemList(
|
||||
[_exchange
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange],
|
||||
[_exchange
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange]);
|
||||
const txData = deployInfo.encode(bytecode, [_exchange
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
@ -663,11 +626,13 @@ export class CoordinatorContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`Coordinator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange];
|
||||
const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [_exchange
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -715,7 +680,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
name: 'data',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
name: 'getTransactionHash',
|
||||
@ -752,7 +717,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
name: 'approvalExpirationTimeSeconds',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
name: 'getCoordinatorApprovalHash',
|
||||
@ -785,7 +750,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
name: 'data',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'txOrigin',
|
||||
@ -805,14 +770,16 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'executeTransaction',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'EIP712_EXCHANGE_DOMAIN_HASH',
|
||||
outputs: [
|
||||
{
|
||||
@ -843,7 +810,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
name: 'data',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'txOrigin',
|
||||
@ -863,7 +830,8 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'assertValidCoordinatorApprovals',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
@ -930,7 +898,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -939,7 +907,8 @@ export class CoordinatorContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'EIP712_COORDINATOR_DOMAIN_HASH',
|
||||
outputs: [
|
||||
{
|
||||
@ -958,7 +927,8 @@ export class CoordinatorContract extends BaseContract {
|
||||
type: 'address',
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor',
|
||||
@ -966,8 +936,8 @@ export class CoordinatorContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
||||
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
BaseContract,
|
||||
import { BaseContract,
|
||||
BlockRange,
|
||||
EventCallback,
|
||||
IndexedFilterValues,
|
||||
SubscriptionManager,
|
||||
PromiseWithTransactionHash,
|
||||
} from '@0x/base-contract';
|
||||
SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
@ -29,9 +26,11 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs;
|
||||
export type CoordinatorRegistryEventArgs =
|
||||
| CoordinatorRegistryCoordinatorEndpointSetEventArgs;
|
||||
|
||||
export enum CoordinatorRegistryEvents {
|
||||
CoordinatorEndpointSet = 'CoordinatorEndpointSet',
|
||||
@ -42,15 +41,20 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco
|
||||
coordinatorEndpoint: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class CoordinatorRegistryContract extends BaseContract {
|
||||
public setCoordinatorEndpoint = {
|
||||
async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
coordinatorEndpoint: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -58,7 +62,10 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.setCoordinatorEndpoint.estimateGasAsync.bind(self, coordinatorEndpoint),
|
||||
self.setCoordinatorEndpoint.estimateGasAsync.bind(
|
||||
self,
|
||||
coordinatorEndpoint
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -74,8 +81,9 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -88,10 +96,14 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(coordinatorEndpoint: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
coordinatorEndpoint: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -111,7 +123,8 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
coordinatorEndpoint: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -121,8 +134,9 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -131,23 +145,23 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(coordinatorEndpoint: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
coordinatorEndpoint: string,
|
||||
): string {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [
|
||||
coordinatorEndpoint,
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -157,7 +171,8 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
coordinatorOperator: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('coordinatorOperator', coordinatorOperator);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -167,9 +182,8 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [
|
||||
coordinatorOperator.toLowerCase(),
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -179,23 +193,23 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(coordinatorOperator: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
coordinatorOperator: string,
|
||||
): string {
|
||||
assert.isString('coordinatorOperator', coordinatorOperator);
|
||||
const self = (this as any) as CoordinatorRegistryContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [
|
||||
coordinatorOperator.toLowerCase(),
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -205,6 +219,7 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -217,13 +232,15 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -233,7 +250,11 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -247,15 +268,12 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`CoordinatorRegistry successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new CoordinatorRegistryContract(
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
);
|
||||
const contractInstance = new CoordinatorRegistryContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -270,7 +288,8 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'setCoordinatorEndpoint',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -295,8 +314,10 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
inputs: [
|
||||
],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor',
|
||||
@ -316,7 +337,8 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'CoordinatorEndpointSet',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
] as ContractAbi;
|
||||
@ -390,8 +412,8 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
);
|
||||
return logs;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<CoordinatorRegistryEventArgs, CoordinatorRegistryEvents>(
|
||||
CoordinatorRegistryContract.ABI(),
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -21,35 +21,23 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class DutchAuctionContract extends BaseContract {
|
||||
public getAuctionDetails = {
|
||||
async sendTransactionAsync(
|
||||
order: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
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> | undefined,
|
||||
): Promise<string> {
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
|
||||
[order],
|
||||
);
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -57,7 +45,10 @@ export class DutchAuctionContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.getAuctionDetails.estimateGasAsync.bind(self, order),
|
||||
self.getAuctionDetails.estimateGasAsync.bind(
|
||||
self,
|
||||
order
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -67,26 +58,15 @@ export class DutchAuctionContract extends BaseContract {
|
||||
return txHash;
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
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;
|
||||
},
|
||||
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>,
|
||||
pollingIntervalMs?: number,
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData);
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -100,27 +80,13 @@ export class DutchAuctionContract extends BaseContract {
|
||||
);
|
||||
},
|
||||
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;
|
||||
},
|
||||
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> | undefined,
|
||||
): Promise<number> {
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
|
||||
[order],
|
||||
);
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -137,30 +103,12 @@ export class DutchAuctionContract extends BaseContract {
|
||||
return gas;
|
||||
},
|
||||
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;
|
||||
},
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{
|
||||
beginTimeSeconds: BigNumber;
|
||||
endTimeSeconds: BigNumber;
|
||||
beginAmount: BigNumber;
|
||||
endAmount: BigNumber;
|
||||
currentAmount: BigNumber;
|
||||
currentTimeSeconds: BigNumber;
|
||||
}> {
|
||||
): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
|
||||
> {
|
||||
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -169,11 +117,9 @@ export class DutchAuctionContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
|
||||
[order],
|
||||
);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -182,90 +128,45 @@ export class DutchAuctionContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<{
|
||||
beginTimeSeconds: BigNumber;
|
||||
endTimeSeconds: BigNumber;
|
||||
beginAmount: BigNumber;
|
||||
endAmount: BigNumber;
|
||||
currentAmount: BigNumber;
|
||||
currentTimeSeconds: BigNumber;
|
||||
}>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(order: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
}): string {
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
|
||||
[order],
|
||||
);
|
||||
getABIEncodedTransactionData(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
): string {
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public matchOrders = {
|
||||
async sendTransactionAsync(
|
||||
buyOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
sellOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
buySignature: string,
|
||||
sellSignature: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
|
||||
[buyOrder, sellOrder, buySignature, sellSignature],
|
||||
);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -273,7 +174,13 @@ export class DutchAuctionContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.matchOrders.estimateGasAsync.bind(self, buyOrder, sellOrder, buySignature, sellSignature),
|
||||
self.matchOrders.estimateGasAsync.bind(
|
||||
self,
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -283,50 +190,24 @@ export class DutchAuctionContract extends BaseContract {
|
||||
return txHash;
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
buyOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
sellOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
buySignature: string,
|
||||
sellSignature: string,
|
||||
txData?: Partial<TxData>,
|
||||
pollingIntervalMs?: number,
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const txHashPromise = self.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature,
|
||||
txData,
|
||||
);
|
||||
sellSignature
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -340,45 +221,22 @@ export class DutchAuctionContract extends BaseContract {
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(
|
||||
buyOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
sellOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
buySignature: string,
|
||||
sellSignature: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
|
||||
[buyOrder, sellOrder, buySignature, sellSignature],
|
||||
);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -395,53 +253,16 @@ export class DutchAuctionContract extends BaseContract {
|
||||
return gas;
|
||||
},
|
||||
async callAsync(
|
||||
buyOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
sellOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
buySignature: string,
|
||||
sellSignature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{
|
||||
left: {
|
||||
makerAssetFilledAmount: BigNumber;
|
||||
takerAssetFilledAmount: BigNumber;
|
||||
makerFeePaid: BigNumber;
|
||||
takerFeePaid: BigNumber;
|
||||
};
|
||||
right: {
|
||||
makerAssetFilledAmount: BigNumber;
|
||||
takerAssetFilledAmount: BigNumber;
|
||||
makerFeePaid: BigNumber;
|
||||
takerFeePaid: BigNumber;
|
||||
};
|
||||
leftMakerAssetSpreadAmount: BigNumber;
|
||||
}> {
|
||||
): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
|
||||
> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -452,11 +273,12 @@ export class DutchAuctionContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
|
||||
[buyOrder, sellOrder, buySignature, sellSignature],
|
||||
);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -465,73 +287,33 @@ export class DutchAuctionContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<{
|
||||
left: {
|
||||
makerAssetFilledAmount: BigNumber;
|
||||
takerAssetFilledAmount: BigNumber;
|
||||
makerFeePaid: BigNumber;
|
||||
takerFeePaid: BigNumber;
|
||||
};
|
||||
right: {
|
||||
makerAssetFilledAmount: BigNumber;
|
||||
takerAssetFilledAmount: BigNumber;
|
||||
makerFeePaid: BigNumber;
|
||||
takerFeePaid: BigNumber;
|
||||
};
|
||||
leftMakerAssetSpreadAmount: BigNumber;
|
||||
}>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
buyOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
sellOrder: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
buySignature: string,
|
||||
sellSignature: string,
|
||||
): string {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = (this as any) as DutchAuctionContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
|
||||
[buyOrder, sellOrder, buySignature, sellSignature],
|
||||
);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -539,6 +321,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -552,13 +335,16 @@ export class DutchAuctionContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
@ -569,14 +355,17 @@ export class DutchAuctionContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange] = BaseContract._formatABIDataItemList(
|
||||
[_exchange
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange],
|
||||
[_exchange
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange]);
|
||||
const txData = deployInfo.encode(bytecode, [_exchange
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
@ -587,11 +376,13 @@ export class DutchAuctionContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange];
|
||||
const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [_exchange
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -652,7 +443,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
name: 'getAuctionDetails',
|
||||
@ -685,7 +476,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
name: 'currentTimeSeconds',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -747,7 +538,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'sellOrder',
|
||||
@ -801,7 +592,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'buySignature',
|
||||
@ -838,7 +629,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
name: 'takerFeePaid',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'right',
|
||||
@ -860,13 +651,13 @@ export class DutchAuctionContract extends BaseContract {
|
||||
name: 'takerFeePaid',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'leftMakerAssetSpreadAmount',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -880,7 +671,8 @@ export class DutchAuctionContract extends BaseContract {
|
||||
type: 'address',
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor',
|
||||
@ -888,8 +680,8 @@ export class DutchAuctionContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
||||
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
BaseContract,
|
||||
import { BaseContract,
|
||||
BlockRange,
|
||||
EventCallback,
|
||||
IndexedFilterValues,
|
||||
SubscriptionManager,
|
||||
PromiseWithTransactionHash,
|
||||
} from '@0x/base-contract';
|
||||
SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20ProxyEventArgs =
|
||||
@ -50,15 +48,20 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC20ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -66,7 +69,10 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -82,8 +88,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -96,10 +103,14 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -115,7 +126,12 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -125,8 +141,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -135,23 +152,23 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [
|
||||
target.toLowerCase(),
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -161,7 +178,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -171,8 +189,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -181,30 +200,36 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(index_0: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
index_0: BigNumber,
|
||||
): string {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -212,7 +237,10 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -228,8 +256,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -242,10 +271,14 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -261,7 +294,12 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -271,8 +309,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -281,29 +320,33 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [
|
||||
target.toLowerCase(),
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -312,7 +355,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -322,20 +365,20 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('owner()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -348,10 +391,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -360,7 +402,11 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase(),
|
||||
index
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -378,12 +424,10 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
txData,
|
||||
);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(),
|
||||
index
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -403,10 +447,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -428,7 +471,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -439,10 +483,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -452,31 +495,36 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string, index: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'removeAuthorizedAddressAtIndex(address,uint256)',
|
||||
[target.toLowerCase(), index],
|
||||
);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -485,7 +533,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -495,20 +543,20 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -518,7 +566,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -528,8 +577,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -538,29 +588,33 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(index_0: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
index_0: string,
|
||||
): string {
|
||||
assert.isString('index_0', index_0);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [
|
||||
index_0.toLowerCase(),
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -569,7 +623,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -579,29 +633,33 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -609,7 +667,10 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -625,8 +686,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -639,10 +701,14 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -658,7 +724,12 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -668,8 +739,9 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -678,23 +750,23 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(newOwner: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [
|
||||
newOwner.toLowerCase(),
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -704,6 +776,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<ERC20ProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -716,13 +789,15 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC20ProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -732,7 +807,11 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -746,11 +825,12 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -765,7 +845,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'addAuthorizedAddress',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -798,14 +879,16 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'removeAuthorizedAddress',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'owner',
|
||||
outputs: [
|
||||
{
|
||||
@ -830,14 +913,16 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'removeAuthorizedAddressAtIndex',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'getProxyId',
|
||||
outputs: [
|
||||
{
|
||||
@ -870,7 +955,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'getAuthorizedAddresses',
|
||||
outputs: [
|
||||
{
|
||||
@ -891,14 +977,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'transferOwnership',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
inputs: [
|
||||
],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'fallback',
|
||||
@ -918,7 +1007,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'AuthorizedAddressAdded',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
{
|
||||
@ -936,7 +1026,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'AuthorizedAddressRemoved',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
] as ContractAbi;
|
||||
@ -1010,8 +1101,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
);
|
||||
return logs;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ERC20ProxyEventArgs, ERC20ProxyEvents>(
|
||||
ERC20ProxyContract.ABI(),
|
||||
|
@ -1,14 +1,11 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
||||
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
BaseContract,
|
||||
import { BaseContract,
|
||||
BlockRange,
|
||||
EventCallback,
|
||||
IndexedFilterValues,
|
||||
SubscriptionManager,
|
||||
PromiseWithTransactionHash,
|
||||
} from '@0x/base-contract';
|
||||
SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
@ -29,9 +26,12 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs;
|
||||
export type ERC20TokenEventArgs =
|
||||
| ERC20TokenTransferEventArgs
|
||||
| ERC20TokenApprovalEventArgs;
|
||||
|
||||
export enum ERC20TokenEvents {
|
||||
Transfer = 'Transfer',
|
||||
@ -50,6 +50,7 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs {
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
@ -62,10 +63,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -74,7 +74,11 @@ export class ERC20TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
_spender.toLowerCase(),
|
||||
_value
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -92,8 +96,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(),
|
||||
_value
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -113,10 +119,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -138,7 +143,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -149,10 +155,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -162,31 +167,36 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_spender: string, _value: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public totalSupply = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -195,7 +205,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -205,20 +215,20 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -233,11 +243,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -246,7 +255,12 @@ export class ERC20TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -266,13 +280,11 @@ export class ERC20TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
txData,
|
||||
);
|
||||
_value
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -294,11 +306,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -321,7 +332,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
@ -333,11 +345,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -347,27 +358,29 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -377,7 +390,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_owner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber> {
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -387,8 +401,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -397,22 +412,24 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_owner: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_owner: string,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -424,8 +441,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -433,7 +452,11 @@ export class ERC20TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value),
|
||||
self.transfer.estimateGasAsync.bind(
|
||||
self,
|
||||
_to.toLowerCase(),
|
||||
_value
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -451,8 +474,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(),
|
||||
_value
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -465,11 +490,17 @@ export class ERC20TokenContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -490,7 +521,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -501,8 +533,10 @@ export class ERC20TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -511,25 +545,26 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_to: string, _value: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -540,7 +575,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_spender: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber> {
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -551,10 +587,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [
|
||||
_owner.toLowerCase(),
|
||||
_spender.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(),
|
||||
_spender.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -564,25 +599,26 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_owner: string, _spender: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_owner: string,
|
||||
_spender: string,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
const self = (this as any) as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [
|
||||
_owner.toLowerCase(),
|
||||
_spender.toLowerCase(),
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(),
|
||||
_spender.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -592,6 +628,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<ERC20TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -604,13 +641,15 @@ export class ERC20TokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC20TokenContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -620,7 +659,11 @@ export class ERC20TokenContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -634,11 +677,12 @@ export class ERC20TokenContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -669,7 +713,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'totalSupply',
|
||||
outputs: [
|
||||
{
|
||||
@ -793,7 +838,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'Transfer',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
{
|
||||
@ -816,7 +862,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'Approval',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
] as ContractAbi;
|
||||
@ -890,8 +937,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
);
|
||||
return logs;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ERC20TokenEventArgs, ERC20TokenEvents>(
|
||||
ERC20TokenContract.ABI(),
|
||||
|
@ -1,14 +1,11 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
||||
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
BaseContract,
|
||||
import { BaseContract,
|
||||
BlockRange,
|
||||
EventCallback,
|
||||
IndexedFilterValues,
|
||||
SubscriptionManager,
|
||||
PromiseWithTransactionHash,
|
||||
} from '@0x/base-contract';
|
||||
SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721ProxyEventArgs =
|
||||
@ -50,15 +48,20 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC721ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -66,7 +69,10 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -82,8 +88,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -96,10 +103,14 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -115,7 +126,12 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -125,8 +141,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -135,23 +152,23 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [
|
||||
target.toLowerCase(),
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -161,7 +178,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -171,8 +189,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -181,30 +200,36 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(index_0: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
index_0: BigNumber,
|
||||
): string {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -212,7 +237,10 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -228,8 +256,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -242,10 +271,14 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -261,7 +294,12 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -271,8 +309,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -281,29 +320,33 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [
|
||||
target.toLowerCase(),
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -312,7 +355,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -322,20 +365,20 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('owner()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -348,10 +391,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -360,7 +402,11 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase(),
|
||||
index
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -378,12 +424,10 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
txData,
|
||||
);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(),
|
||||
index
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -403,10 +447,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -428,7 +471,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -439,10 +483,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -452,31 +495,36 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string, index: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'removeAuthorizedAddressAtIndex(address,uint256)',
|
||||
[target.toLowerCase(), index],
|
||||
);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -485,7 +533,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -495,20 +543,20 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -518,7 +566,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -528,8 +577,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -538,29 +588,33 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(index_0: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
index_0: string,
|
||||
): string {
|
||||
assert.isString('index_0', index_0);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [
|
||||
index_0.toLowerCase(),
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -569,7 +623,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -579,29 +633,33 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -609,7 +667,10 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -625,8 +686,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -639,10 +701,14 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -658,7 +724,12 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -668,8 +739,9 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -678,23 +750,23 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(newOwner: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [
|
||||
newOwner.toLowerCase(),
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -704,6 +776,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<ERC721ProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -716,13 +789,15 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC721ProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -732,7 +807,11 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -746,11 +825,12 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -765,7 +845,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'addAuthorizedAddress',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -798,14 +879,16 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'removeAuthorizedAddress',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'owner',
|
||||
outputs: [
|
||||
{
|
||||
@ -830,14 +913,16 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'removeAuthorizedAddressAtIndex',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'getProxyId',
|
||||
outputs: [
|
||||
{
|
||||
@ -870,7 +955,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'getAuthorizedAddresses',
|
||||
outputs: [
|
||||
{
|
||||
@ -891,14 +977,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'transferOwnership',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
inputs: [
|
||||
],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'fallback',
|
||||
@ -918,7 +1007,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'AuthorizedAddressAdded',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
{
|
||||
@ -936,7 +1026,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'AuthorizedAddressRemoved',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
] as ContractAbi;
|
||||
@ -1010,8 +1101,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
);
|
||||
return logs;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ERC721ProxyEventArgs, ERC721ProxyEvents>(
|
||||
ERC721ProxyContract.ABI(),
|
||||
|
@ -1,14 +1,11 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
||||
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
BaseContract,
|
||||
import { BaseContract,
|
||||
BlockRange,
|
||||
EventCallback,
|
||||
IndexedFilterValues,
|
||||
SubscriptionManager,
|
||||
PromiseWithTransactionHash,
|
||||
} from '@0x/base-contract';
|
||||
SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721TokenEventArgs =
|
||||
@ -60,6 +58,7 @@ export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs {
|
||||
_approved: boolean;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
@ -69,7 +68,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -79,8 +79,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -89,22 +90,24 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_tokenId: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -116,10 +119,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_approved.toLowerCase(),
|
||||
_tokenId,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(),
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -128,7 +130,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
_approved.toLowerCase(),
|
||||
_tokenId
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -146,8 +152,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(),
|
||||
_tokenId
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -167,10 +175,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_approved.toLowerCase(),
|
||||
_tokenId,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(),
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -192,7 +199,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -203,10 +211,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_approved.toLowerCase(),
|
||||
_tokenId,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(),
|
||||
_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -216,25 +223,26 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_approved.toLowerCase(),
|
||||
_tokenId,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(),
|
||||
_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -249,11 +257,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -262,7 +269,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -282,13 +294,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
txData,
|
||||
);
|
||||
_tokenId
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -310,11 +320,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -337,7 +346,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
@ -349,11 +359,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -363,27 +372,29 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -398,11 +409,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -411,7 +421,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId),
|
||||
self.safeTransferFrom1.estimateGasAsync.bind(
|
||||
self,
|
||||
_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -431,13 +446,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
txData,
|
||||
);
|
||||
_tokenId
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -459,11 +472,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -486,7 +498,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
@ -498,11 +511,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -512,27 +524,29 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -542,7 +556,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -552,8 +567,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -562,22 +578,24 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_tokenId: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -586,7 +604,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_owner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber> {
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -596,8 +615,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -606,22 +626,24 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_owner: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_owner: string,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -633,10 +655,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [
|
||||
_operator.toLowerCase(),
|
||||
_approved,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(),
|
||||
_approved
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -645,7 +666,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved),
|
||||
self.setApprovalForAll.estimateGasAsync.bind(
|
||||
self,
|
||||
_operator.toLowerCase(),
|
||||
_approved
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -663,12 +688,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const txHashPromise = self.setApprovalForAll.sendTransactionAsync(
|
||||
_operator.toLowerCase(),
|
||||
_approved,
|
||||
txData,
|
||||
);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(),
|
||||
_approved
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -688,10 +711,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [
|
||||
_operator.toLowerCase(),
|
||||
_approved,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(),
|
||||
_approved
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -713,7 +735,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_approved: boolean,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -724,10 +747,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [
|
||||
_operator.toLowerCase(),
|
||||
_approved,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(),
|
||||
_approved
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -737,25 +759,26 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_operator: string, _approved: boolean): string {
|
||||
getABIEncodedTransactionData(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
): string {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [
|
||||
_operator.toLowerCase(),
|
||||
_approved,
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(),
|
||||
_approved
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -772,12 +795,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_data,
|
||||
_data
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -791,7 +813,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_data,
|
||||
_data
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
@ -814,14 +836,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_data,
|
||||
txData,
|
||||
);
|
||||
_data
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -845,12 +865,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_data,
|
||||
_data
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -874,7 +893,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_data: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
@ -887,12 +907,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_data,
|
||||
_data
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -902,28 +921,33 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'safeTransferFrom(address,address,uint256,bytes)',
|
||||
[_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data],
|
||||
);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -933,7 +957,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_operator: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_operator', _operator);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -944,10 +969,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [
|
||||
_owner.toLowerCase(),
|
||||
_operator.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(),
|
||||
_operator.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -957,25 +981,26 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_owner: string, _operator: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_owner: string,
|
||||
_operator: string,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_operator', _operator);
|
||||
const self = (this as any) as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [
|
||||
_owner.toLowerCase(),
|
||||
_operator.toLowerCase(),
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(),
|
||||
_operator.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -985,6 +1010,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<ERC721TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -997,13 +1023,15 @@ export class ERC721TokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC721TokenContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -1013,7 +1041,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -1027,11 +1059,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -1069,7 +1102,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'approve',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -1091,7 +1125,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'transferFrom',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -1113,7 +1148,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'safeTransferFrom',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -1169,7 +1205,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'setApprovalForAll',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -1195,7 +1232,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'safeTransferFrom',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -1243,7 +1281,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'Transfer',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
{
|
||||
@ -1266,7 +1305,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'Approval',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
{
|
||||
@ -1289,7 +1329,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'ApprovalForAll',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
] as ContractAbi;
|
||||
@ -1363,8 +1404,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
);
|
||||
return logs;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ERC721TokenEventArgs, ERC721TokenEvents>(
|
||||
ERC721TokenContract.ABI(),
|
||||
|
@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
@ -32,7 +34,8 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
addresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber[]> {
|
||||
): Promise<BigNumber[]
|
||||
> {
|
||||
assert.isArray('addresses', addresses);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -42,8 +45,9 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as EthBalanceCheckerContract;
|
||||
const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]);
|
||||
const self = this as any as EthBalanceCheckerContract;
|
||||
const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -52,22 +56,24 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber[]>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber[]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(addresses: string[]): string {
|
||||
getABIEncodedTransactionData(
|
||||
addresses: string[],
|
||||
): string {
|
||||
assert.isArray('addresses', addresses);
|
||||
const self = (this as any) as EthBalanceCheckerContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]);
|
||||
const self = this as any as EthBalanceCheckerContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -75,6 +81,7 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<EthBalanceCheckerContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -87,13 +94,15 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<EthBalanceCheckerContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -103,7 +112,11 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -117,15 +130,12 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`EthBalanceChecker successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new EthBalanceCheckerContract(
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
);
|
||||
const contractInstance = new EthBalanceCheckerContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -153,8 +163,8 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
3150
packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
generated
3150
packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -21,17 +21,23 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class IAssetProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -39,7 +45,10 @@ export class IAssetProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -55,8 +64,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -69,10 +79,14 @@ export class IAssetProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -88,7 +102,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -98,8 +117,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -108,32 +128,36 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [
|
||||
target.toLowerCase(),
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -141,7 +165,10 @@ export class IAssetProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -157,8 +184,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -171,10 +199,14 @@ export class IAssetProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -190,7 +222,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -200,8 +237,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -210,23 +248,23 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [
|
||||
target.toLowerCase(),
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -239,10 +277,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -251,7 +288,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target.toLowerCase(),
|
||||
index
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -269,12 +310,10 @@ export class IAssetProxyContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
txData,
|
||||
);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(),
|
||||
index
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -294,10 +333,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -319,7 +357,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -330,10 +369,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [
|
||||
target.toLowerCase(),
|
||||
index,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -343,26 +381,27 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string, index: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'removeAuthorizedAddressAtIndex(address,uint256)',
|
||||
[target.toLowerCase(), index],
|
||||
);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(),
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -378,12 +417,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [
|
||||
assetData,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from.toLowerCase(),
|
||||
to.toLowerCase(),
|
||||
amount,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -392,7 +430,13 @@ export class IAssetProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(self, assetData, from.toLowerCase(), to.toLowerCase(), amount),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
assetData,
|
||||
from.toLowerCase(),
|
||||
to.toLowerCase(),
|
||||
amount
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -414,14 +458,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(
|
||||
assetData,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(assetData,
|
||||
from.toLowerCase(),
|
||||
to.toLowerCase(),
|
||||
amount,
|
||||
txData,
|
||||
);
|
||||
amount
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -445,12 +487,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [
|
||||
assetData,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from.toLowerCase(),
|
||||
to.toLowerCase(),
|
||||
amount,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -474,7 +515,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
amount: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void> {
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
@ -487,12 +529,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [
|
||||
assetData,
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from.toLowerCase(),
|
||||
to.toLowerCase(),
|
||||
amount,
|
||||
amount
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -502,33 +543,42 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(assetData: string, from: string, to: string, amount: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'transferFrom(bytes,address,address,uint256)',
|
||||
[assetData, from.toLowerCase(), to.toLowerCase(), amount],
|
||||
);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from.toLowerCase(),
|
||||
to.toLowerCase(),
|
||||
amount
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -537,7 +587,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -547,26 +597,30 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -575,7 +629,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -585,29 +639,33 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -615,7 +673,10 @@ export class IAssetProxyContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner.toLowerCase()
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -631,8 +692,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
timeoutMs?: number,
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase()
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -645,10 +707,14 @@ export class IAssetProxyContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -664,7 +730,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -674,8 +745,9 @@ export class IAssetProxyContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -684,23 +756,23 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(newOwner: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = (this as any) as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [
|
||||
newOwner.toLowerCase(),
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -709,6 +781,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<IAssetProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -721,13 +794,15 @@ export class IAssetProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<IAssetProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -737,7 +812,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -751,11 +830,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -770,7 +850,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'addAuthorizedAddress',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -784,7 +865,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'removeAuthorizedAddress',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -802,7 +884,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'removeAuthorizedAddressAtIndex',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -828,14 +911,16 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'transferFrom',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'getProxyId',
|
||||
outputs: [
|
||||
{
|
||||
@ -849,7 +934,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'getAuthorizedAddresses',
|
||||
outputs: [
|
||||
{
|
||||
@ -870,7 +956,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'transferOwnership',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
@ -878,8 +965,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
@ -34,7 +36,8 @@ export class IValidatorContract extends BaseContract {
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signerAddress', signerAddress);
|
||||
assert.isString('signature', signature);
|
||||
@ -46,11 +49,10 @@ export class IValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [
|
||||
hash,
|
||||
const self = this as any as IValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash,
|
||||
signerAddress.toLowerCase(),
|
||||
signature,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -60,27 +62,29 @@ export class IValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
): string {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signerAddress', signerAddress);
|
||||
assert.isString('signature', signature);
|
||||
const self = (this as any) as IValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [
|
||||
hash,
|
||||
const self = this as any as IValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash,
|
||||
signerAddress.toLowerCase(),
|
||||
signature,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -89,6 +93,7 @@ export class IValidatorContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<IValidatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -101,13 +106,15 @@ export class IValidatorContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<IValidatorContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -117,7 +124,11 @@ export class IValidatorContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -131,11 +142,12 @@ export class IValidatorContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -171,8 +183,8 @@ export class IValidatorContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
@ -33,7 +35,8 @@ export class IWalletContract extends BaseContract {
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signature', signature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -44,8 +47,10 @@ export class IWalletContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as IWalletContract;
|
||||
const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, signature]);
|
||||
const self = this as any as IWalletContract;
|
||||
const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -54,25 +59,26 @@ export class IWalletContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(hash: string, signature: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
hash: string,
|
||||
signature: string,
|
||||
): string {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signature', signature);
|
||||
const self = (this as any) as IWalletContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [
|
||||
hash,
|
||||
signature,
|
||||
const self = this as any as IWalletContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -81,6 +87,7 @@ export class IWalletContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<IWalletContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -93,13 +100,15 @@ export class IWalletContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<IWalletContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -109,7 +118,11 @@ export class IWalletContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -123,11 +136,12 @@ export class IWalletContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -159,8 +173,8 @@ export class IWalletContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,46 +21,23 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class OrderValidatorContract extends BaseContract {
|
||||
public getOrderAndTraderInfo = {
|
||||
async callAsync(
|
||||
order: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<
|
||||
[
|
||||
{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber },
|
||||
{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}
|
||||
]
|
||||
): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
|
||||
> {
|
||||
|
||||
assert.isString('takerAddress', takerAddress);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -70,11 +47,10 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
|
||||
[order, takerAddress.toLowerCase()],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
|
||||
takerAddress.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -83,57 +59,27 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<
|
||||
[
|
||||
{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber },
|
||||
{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}
|
||||
]
|
||||
const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
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;
|
||||
},
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
): string {
|
||||
|
||||
assert.isString('takerAddress', takerAddress);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
|
||||
[order, takerAddress.toLowerCase()],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
|
||||
takerAddress.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -143,7 +89,8 @@ export class OrderValidatorContract extends BaseContract {
|
||||
assetData: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber, BigNumber]> {
|
||||
): Promise<[BigNumber, BigNumber]
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isString('assetData', assetData);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -154,10 +101,9 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [
|
||||
target.toLowerCase(),
|
||||
assetData,
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(),
|
||||
assetData
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -167,62 +113,37 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string, assetData: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
assetData: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isString('assetData', assetData);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [
|
||||
target.toLowerCase(),
|
||||
assetData,
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(),
|
||||
assetData
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getOrdersAndTradersInfo = {
|
||||
async callAsync(
|
||||
orders: Array<{
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
}>,
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
takerAddresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<
|
||||
[
|
||||
Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
|
||||
Array<{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}>
|
||||
]
|
||||
): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
|
||||
> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('takerAddresses', takerAddresses);
|
||||
@ -234,11 +155,10 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
|
||||
[orders, takerAddresses],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -247,91 +167,37 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<
|
||||
[
|
||||
Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
|
||||
Array<{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}>
|
||||
]
|
||||
const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
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;
|
||||
}>,
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
takerAddresses: string[],
|
||||
): string {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('takerAddresses', takerAddresses);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
|
||||
[orders, takerAddresses],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getTradersInfo = {
|
||||
async callAsync(
|
||||
orders: Array<{
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
}>,
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
takerAddresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<
|
||||
Array<{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}>
|
||||
): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
|
||||
> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('takerAddresses', takerAddresses);
|
||||
@ -343,11 +209,10 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
|
||||
[orders, takerAddresses],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -356,55 +221,27 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<
|
||||
Array<{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}>
|
||||
const result = abiEncoder.strictDecodeReturnValue<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
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;
|
||||
}>,
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
takerAddresses: string[],
|
||||
): string {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('takerAddresses', takerAddresses);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
|
||||
[orders, takerAddresses],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -414,7 +251,8 @@ export class OrderValidatorContract extends BaseContract {
|
||||
tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string> {
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('token', token);
|
||||
assert.isBigNumber('tokenId', tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -425,10 +263,9 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [
|
||||
token.toLowerCase(),
|
||||
tokenId,
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(),
|
||||
tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -438,25 +275,26 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(token: string, tokenId: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
token: string,
|
||||
tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('token', token);
|
||||
assert.isBigNumber('tokenId', tokenId);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [
|
||||
token.toLowerCase(),
|
||||
tokenId,
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(),
|
||||
tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -467,7 +305,8 @@ export class OrderValidatorContract extends BaseContract {
|
||||
assetData: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber[], BigNumber[]]> {
|
||||
): Promise<[BigNumber[], BigNumber[]]
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isArray('assetData', assetData);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -478,10 +317,9 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [
|
||||
target.toLowerCase(),
|
||||
assetData,
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(),
|
||||
assetData
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -491,58 +329,39 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(target: string, assetData: string[]): string {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
assetData: string[],
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isArray('assetData', assetData);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [
|
||||
target.toLowerCase(),
|
||||
assetData,
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(),
|
||||
assetData
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public getTraderInfo = {
|
||||
async callAsync(
|
||||
order: {
|
||||
makerAddress: string;
|
||||
takerAddress: string;
|
||||
feeRecipientAddress: string;
|
||||
senderAddress: string;
|
||||
makerAssetAmount: BigNumber;
|
||||
takerAssetAmount: BigNumber;
|
||||
makerFee: BigNumber;
|
||||
takerFee: BigNumber;
|
||||
expirationTimeSeconds: BigNumber;
|
||||
salt: BigNumber;
|
||||
makerAssetData: string;
|
||||
takerAssetData: string;
|
||||
},
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}> {
|
||||
): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
|
||||
> {
|
||||
|
||||
assert.isString('takerAddress', takerAddress);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -552,11 +371,10 @@ export class OrderValidatorContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments(
|
||||
'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
|
||||
[order, takerAddress.toLowerCase()],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
|
||||
takerAddress.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -565,52 +383,27 @@ export class OrderValidatorContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder(
|
||||
'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<{
|
||||
makerBalance: BigNumber;
|
||||
makerAllowance: BigNumber;
|
||||
takerBalance: BigNumber;
|
||||
takerAllowance: BigNumber;
|
||||
makerZrxBalance: BigNumber;
|
||||
makerZrxAllowance: BigNumber;
|
||||
takerZrxBalance: BigNumber;
|
||||
takerZrxAllowance: BigNumber;
|
||||
}>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
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;
|
||||
},
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
): string {
|
||||
|
||||
assert.isString('takerAddress', takerAddress);
|
||||
const self = (this as any) as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments(
|
||||
'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
|
||||
[order, takerAddress.toLowerCase()],
|
||||
);
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
|
||||
takerAddress.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
@ -618,6 +411,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
@ -632,13 +426,17 @@ export class OrderValidatorContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange, _zrxAssetData);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange,
|
||||
_zrxAssetData
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
@ -650,14 +448,20 @@ export class OrderValidatorContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange, _zrxAssetData] = BaseContract._formatABIDataItemList(
|
||||
[_exchange,
|
||||
_zrxAssetData
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange, _zrxAssetData],
|
||||
[_exchange,
|
||||
_zrxAssetData
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData]);
|
||||
const txData = deployInfo.encode(bytecode, [_exchange,
|
||||
_zrxAssetData
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
@ -668,11 +472,14 @@ export class OrderValidatorContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange, _zrxAssetData];
|
||||
const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [_exchange,
|
||||
_zrxAssetData
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -733,7 +540,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'takerAddress',
|
||||
@ -758,7 +565,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'orderTakerAssetFilledAmount',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'traderInfo',
|
||||
@ -796,7 +603,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerZrxAllowance',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -885,7 +692,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'takerAddresses',
|
||||
@ -910,7 +717,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'orderTakerAssetFilledAmount',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'tradersInfo',
|
||||
@ -948,7 +755,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerZrxAllowance',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -1010,7 +817,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'takerAddresses',
|
||||
@ -1055,7 +862,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerZrxAllowance',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -1167,7 +974,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'takerAddress',
|
||||
@ -1212,7 +1019,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
name: 'takerZrxAllowance',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
@ -1230,7 +1037,8 @@ export class OrderValidatorContract extends BaseContract {
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor',
|
||||
@ -1238,8 +1046,8 @@ export class OrderValidatorContract extends BaseContract {
|
||||
] as ContractAbi;
|
||||
return abi;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,11 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
|
||||
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
|
||||
// tslint:disable:no-unused-variable
|
||||
import {
|
||||
BaseContract,
|
||||
import { BaseContract,
|
||||
BlockRange,
|
||||
EventCallback,
|
||||
IndexedFilterValues,
|
||||
SubscriptionManager,
|
||||
PromiseWithTransactionHash,
|
||||
} from '@0x/base-contract';
|
||||
SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
@ -29,9 +26,12 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs;
|
||||
export type ZRXTokenEventArgs =
|
||||
| ZRXTokenTransferEventArgs
|
||||
| ZRXTokenApprovalEventArgs;
|
||||
|
||||
export enum ZRXTokenEvents {
|
||||
Transfer = 'Transfer',
|
||||
@ -50,12 +50,17 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs {
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ZRXTokenContract extends BaseContract {
|
||||
public name = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -64,7 +69,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('name()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -74,20 +79,20 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('name()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('name()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -100,10 +105,9 @@ export class ZRXTokenContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -112,7 +116,11 @@ export class ZRXTokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
_spender.toLowerCase(),
|
||||
_value
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -130,8 +138,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(),
|
||||
_value
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -151,10 +161,9 @@ export class ZRXTokenContract extends BaseContract {
|
||||
): Promise<number> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -176,7 +185,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -187,10 +197,9 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -200,31 +209,36 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_spender: string, _value: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [
|
||||
_spender.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public totalSupply = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -233,7 +247,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -243,20 +257,20 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -271,11 +285,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -284,7 +297,12 @@ export class ZRXTokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -304,13 +322,11 @@ export class ZRXTokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
txData,
|
||||
);
|
||||
_value
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -332,11 +348,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -359,7 +374,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
@ -371,11 +387,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -385,33 +400,39 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [
|
||||
_from.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(),
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public decimals = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<number
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -420,7 +441,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('decimals()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -430,20 +451,20 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('decimals()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<number>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<number
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -453,7 +474,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_owner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber> {
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -463,8 +485,9 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -473,27 +496,33 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_owner: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_owner: string,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
};
|
||||
public symbol = {
|
||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
@ -502,7 +531,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('symbol()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -512,20 +541,20 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('symbol()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -538,8 +567,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
): Promise<string> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -547,7 +578,11 @@ export class ZRXTokenContract extends BaseContract {
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value),
|
||||
self.transfer.estimateGasAsync.bind(
|
||||
self,
|
||||
_to.toLowerCase(),
|
||||
_value
|
||||
),
|
||||
);
|
||||
if (txDataWithDefaults.from !== undefined) {
|
||||
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
|
||||
@ -565,8 +600,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(),
|
||||
_value
|
||||
, txData);
|
||||
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
|
||||
txHashPromise,
|
||||
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
|
||||
@ -579,11 +616,17 @@ export class ZRXTokenContract extends BaseContract {
|
||||
})(),
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -604,7 +647,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean> {
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -615,8 +659,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
@ -625,25 +671,26 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<boolean
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_to: string, _value: BigNumber): string {
|
||||
getABIEncodedTransactionData(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [
|
||||
_to.toLowerCase(),
|
||||
_value,
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(),
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -654,7 +701,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_spender: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber> {
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
@ -665,10 +713,9 @@ export class ZRXTokenContract extends BaseContract {
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [
|
||||
_owner.toLowerCase(),
|
||||
_spender.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(),
|
||||
_spender.toLowerCase()
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@ -678,25 +725,26 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
callDataWithDefaults.from = callDataWithDefaults.from
|
||||
? callDataWithDefaults.from.toLowerCase()
|
||||
: callDataWithDefaults.from;
|
||||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from;
|
||||
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber>(rawCallResult);
|
||||
const result = abiEncoder.strictDecodeReturnValue<BigNumber
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
getABIEncodedTransactionData(_owner: string, _spender: string): string {
|
||||
getABIEncodedTransactionData(
|
||||
_owner: string,
|
||||
_spender: string,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
const self = (this as any) as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [
|
||||
_owner.toLowerCase(),
|
||||
_spender.toLowerCase(),
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(),
|
||||
_spender.toLowerCase()
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
@ -706,6 +754,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
): Promise<ZRXTokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@ -718,13 +767,15 @@ export class ZRXTokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults);
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ZRXTokenContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@ -734,7 +785,11 @@ export class ZRXTokenContract extends BaseContract {
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
@ -748,11 +803,12 @@ export class ZRXTokenContract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults);
|
||||
const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The contract ABI
|
||||
*/
|
||||
@ -760,7 +816,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
const abi = [
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'name',
|
||||
outputs: [
|
||||
{
|
||||
@ -795,7 +852,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'totalSupply',
|
||||
outputs: [
|
||||
{
|
||||
@ -834,7 +892,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'decimals',
|
||||
outputs: [
|
||||
{
|
||||
@ -865,7 +924,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
inputs: [
|
||||
],
|
||||
name: 'symbol',
|
||||
outputs: [
|
||||
{
|
||||
@ -921,8 +981,10 @@ export class ZRXTokenContract extends BaseContract {
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
inputs: [
|
||||
],
|
||||
outputs: [
|
||||
],
|
||||
payable: false,
|
||||
type: 'constructor',
|
||||
},
|
||||
@ -946,7 +1008,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'Transfer',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
{
|
||||
@ -969,7 +1032,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
},
|
||||
],
|
||||
name: 'Approval',
|
||||
outputs: [],
|
||||
outputs: [
|
||||
],
|
||||
type: 'event',
|
||||
},
|
||||
] as ContractAbi;
|
||||
@ -1043,8 +1107,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
);
|
||||
return logs;
|
||||
}
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults);
|
||||
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>, logDecodeDependencies?: { [contractName: string]: ContractAbi }) {
|
||||
super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
|
||||
this._subscriptionManager = new SubscriptionManager<ZRXTokenEventArgs, ZRXTokenEvents>(
|
||||
ZRXTokenContract.ABI(),
|
||||
|
@ -30,7 +30,12 @@ describe('AbiGenDummy Contract', () => {
|
||||
let abiGenDummy: AbiGenDummyContract;
|
||||
before(async () => {
|
||||
providerUtils.startProviderEngine(provider);
|
||||
abiGenDummy = await AbiGenDummyContract.deployFrom0xArtifactAsync(artifacts.AbiGenDummy, provider, txDefaults);
|
||||
abiGenDummy = await AbiGenDummyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.AbiGenDummy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
await blockchainLifecycle.startAsync();
|
||||
});
|
||||
after(async () => {
|
||||
@ -146,7 +151,12 @@ describe('Lib dummy contract', () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
before(async () => {
|
||||
libDummy = await TestLibDummyContract.deployFrom0xArtifactAsync(artifacts.TestLibDummy, provider, txDefaults);
|
||||
libDummy = await TestLibDummyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestLibDummy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
|
@ -212,8 +212,8 @@ export class BaseContract {
|
||||
this._abiEncoderByFunctionSignature[functionSignature] = abiEncoder;
|
||||
this._web3Wrapper.abiDecoder.addABI(abi, contractName);
|
||||
});
|
||||
_.each(abiDependencies, (abi, name) => {
|
||||
this._web3Wrapper.abiDecoder.addABI(abi, name);
|
||||
_.each(abiDependencies, (abiDependency, contractDependencyName) => {
|
||||
this._web3Wrapper.abiDecoder.addABI(abiDependency, contractDependencyName);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -351,10 +351,12 @@ describe('ExchangeWrapper', () => {
|
||||
});
|
||||
});
|
||||
it('should throw when the ERC20 token has transfer restrictions', async () => {
|
||||
const artifactDependencies = {};
|
||||
const untransferrableToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
UntransferrableDummyERC20Token,
|
||||
provider,
|
||||
{ from: userAddresses[0] },
|
||||
artifactDependencies,
|
||||
'UntransferrableToken',
|
||||
'UTT',
|
||||
new BigNumber(constants.ZRX_DECIMALS),
|
||||
|
@ -29,11 +29,13 @@ export async function runMigrationsAsync(
|
||||
artifacts.ERC20Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
const erc721Proxy = await wrappers.ERC721ProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.ERC721Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
// ZRX
|
||||
@ -41,10 +43,16 @@ export async function runMigrationsAsync(
|
||||
artifacts.ZRXToken,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
// Ether token
|
||||
const etherToken = await wrappers.WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
|
||||
const etherToken = await wrappers.WETH9Contract.deployFrom0xArtifactAsync(
|
||||
artifacts.WETH9,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
// Exchange
|
||||
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
|
||||
@ -52,6 +60,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
zrxAssetData,
|
||||
);
|
||||
|
||||
@ -63,6 +72,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
token.name,
|
||||
token.symbol,
|
||||
token.decimals,
|
||||
@ -76,6 +86,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
erc721TokenInfo[0].name,
|
||||
erc721TokenInfo[0].symbol,
|
||||
);
|
||||
@ -84,6 +95,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
@ -126,6 +138,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.Forwarder,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
assetDataUtils.encodeERC20AssetData(zrxToken.address),
|
||||
assetDataUtils.encodeERC20AssetData(etherToken.address),
|
||||
@ -136,6 +149,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.OrderValidator,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
zrxAssetData,
|
||||
);
|
||||
@ -145,6 +159,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.DutchAuction,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
);
|
||||
|
||||
@ -159,6 +174,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.AssetProxyOwner,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
owners,
|
||||
[erc20Proxy.address, erc721Proxy.address, multiAssetProxy.address],
|
||||
confirmationsRequired,
|
||||
@ -188,6 +204,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.CoordinatorRegistry,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
|
||||
// Coordinator
|
||||
@ -195,6 +212,7 @@ export async function runMigrationsAsync(
|
||||
artifacts.Coordinator,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
);
|
||||
|
||||
|
@ -46,6 +46,7 @@ describe('ExchangeTransferSimulator', async () => {
|
||||
artifacts.ERC20Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
erc20ProxyAddress = erc20Proxy.address;
|
||||
|
||||
@ -58,6 +59,7 @@ describe('ExchangeTransferSimulator', async () => {
|
||||
artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
name,
|
||||
symbol,
|
||||
decimals,
|
||||
|
Loading…
x
Reference in New Issue
Block a user