From db8837f4ce2709f1fc14b142758df8260197f280 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 6 Nov 2019 20:52:07 -0800 Subject: [PATCH 1/3] Redeploy DevUtils and ZeroExGovernor on testnets --- packages/contract-addresses/addresses.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/contract-addresses/addresses.json b/packages/contract-addresses/addresses.json index 5af7c26406..acd265f741 100644 --- a/packages/contract-addresses/addresses.json +++ b/packages/contract-addresses/addresses.json @@ -39,7 +39,7 @@ "multiAssetProxy": "0xab8fbd189c569ccdee3a4d929bb7f557be4028f6", "staticCallProxy": "0xe1b97e47aa3796276033a5341e884d2ba46b6ac1", "erc1155Proxy": "0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d", - "devUtils": "0x6bb2fc91a82b55c02b88873958a19e04fbd02090", + "devUtils": "0x1f7a9c2e2c25ab1a894af1fd816599860ee2276c", "zrxVault": "0xffd161026865ad8b4ab28a76840474935eec4dfa", "staking": "0x3f46b98061a3e1e1f41dff296ec19402c298f8a9", "stakingProxy": "0xfaabcee42ab6b9c649794ac6c133711071897ee9", @@ -62,7 +62,7 @@ "multiAssetProxy": "0xb34cde0ad3a83d04abebc0b66e75196f22216621", "staticCallProxy": "0xe1b97e47aa3796276033a5341e884d2ba46b6ac1", "erc1155Proxy": "0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d", - "devUtils": "0x326a303dc0fe20f43acb8e5dec99154e47f32d01", + "devUtils": "0xfd21088fb008349839c2209ecbde97a7a4d2e397", "zrxVault": "0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224", "staking": "0x344d4f661a82afdd84d31456c291822d90d5dc3a", "stakingProxy": "0xc6ad5277ea225ac05e271eb14a7ebb480cd9dd9f", @@ -85,7 +85,7 @@ "multiAssetProxy": "0xf6313a772c222f51c28f2304c0703b8cf5428fd8", "staticCallProxy": "0x48e94bdb9033640d45ea7c721e25f380f8bffa43", "erc1155Proxy": "0x64517fa2b480ba3678a2a3c0cf08ef7fd4fad36f", - "devUtils": "0x5078321eec0fd8db5d61d25cce3ea2d6379bb5df", + "devUtils": "0xa3858baf73430c2fa2339c731e3ffb04ea5e359c", "zrxVault": "0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291", "staking": "0x89150f5eed50b3528f79bfb539f29d727f92821c", "stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34", From 21fab3ef9f71cab24da1244a118c7f78a06dedd3 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Thu, 7 Nov 2019 23:00:00 +1100 Subject: [PATCH 2/3] Added Staking and ERC20 Bridge to migrations --- packages/abi-gen-wrappers/package.json | 2 +- .../generated-wrappers/erc20_bridge_proxy.ts | 1667 +++++ .../src/generated-wrappers/staking.ts | 30 +- .../src/generated-wrappers/test_staking.ts | 6585 +++++++++++++++++ .../src/generated-wrappers/zrx_vault.ts | 2719 +++++++ packages/abi-gen-wrappers/src/index.ts | 24 + packages/contract-addresses/addresses.json | 12 +- .../artifacts/ERC20BridgeProxy.json | 218 + .../artifacts/TestStaking.json | 844 +++ .../artifacts/ZrxVault.json | 296 + packages/contract-artifacts/src/index.ts | 47 +- packages/contract-artifacts/tsconfig.json | 5 +- packages/migrations/src/migration.ts | 106 +- packages/migrations/src/utils/token_info.ts | 4 +- 14 files changed, 12495 insertions(+), 64 deletions(-) create mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts create mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts create mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts create mode 100644 packages/contract-artifacts/artifacts/ERC20BridgeProxy.json create mode 100644 packages/contract-artifacts/artifacts/TestStaking.json create mode 100644 packages/contract-artifacts/artifacts/ZrxVault.json diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json index b265bbcba6..fc09011903 100644 --- a/packages/abi-gen-wrappers/package.json +++ b/packages/abi-gen-wrappers/package.json @@ -21,7 +21,7 @@ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output src/generated-wrappers --backend ethers" }, "config": { - "abis": "../contract-artifacts/artifacts/@(DevUtils|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Token|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|Coordinator|CoordinatorRegistry|Staking|StakingProxy).json" + "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DevUtils|DutchAuction|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker|ERC1155Proxy|StaticCallProxy|Staking|StakingProxy|TestStaking|ZrxVault|ERC20BridgeProxy).json" }, "repository": { "type": "git", diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts new file mode 100644 index 0000000000..b7101db3bd --- /dev/null +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts @@ -0,0 +1,1667 @@ +// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming +// tslint:disable:whitespace no-unbound-method no-trailing-whitespace +// tslint:disable:no-unused-variable +import { BaseContract, SubscriptionManager, PromiseWithTransactionHash } from '@0x/base-contract'; +import { schemas } from '@0x/json-schemas'; +import { + BlockParam, + BlockParamLiteral, + BlockRange, + CallData, + ContractAbi, + ContractArtifact, + DecodedLogArgs, + LogWithDecodedArgs, + MethodAbi, + TransactionReceiptWithDecodedLogs, + TxData, + TxDataPayable, + SupportedProvider, +} from 'ethereum-types'; +import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; +import { Web3Wrapper } from '@0x/web3-wrapper'; +import { assert } from '@0x/assert'; +import * as ethers from 'ethers'; +// tslint:enable:no-unused-variable + +export type ERC20BridgeProxyEventArgs = + | ERC20BridgeProxyAuthorizedAddressAddedEventArgs + | ERC20BridgeProxyAuthorizedAddressRemovedEventArgs + | ERC20BridgeProxyOwnershipTransferredEventArgs; + +export enum ERC20BridgeProxyEvents { + AuthorizedAddressAdded = 'AuthorizedAddressAdded', + AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', + OwnershipTransferred = 'OwnershipTransferred', +} + +export interface ERC20BridgeProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs { + target: string; + caller: string; +} + +export interface ERC20BridgeProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { + target: string; + caller: string; +} + +export interface ERC20BridgeProxyOwnershipTransferredEventArgs extends DecodedLogArgs { + previousOwner: string; + newOwner: string; +} + +/* istanbul ignore next */ +// tslint:disable:no-parameter-reassignment +// tslint:disable-next-line:class-name +export class ERC20BridgeProxyContract extends BaseContract { + /** + * @ignore + */ + public static deployedBytecode = + '0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a85e59e411610081578063d39de6e91161005b578063d39de6e914610182578063f2fde38b14610197578063fc124ebd146101aa576100c9565b8063a85e59e41461013a578063ae25532e1461014d578063b918161114610162576100c9565b806370712939116100b2578063707129391461010c5780638da5cb5b1461011f5780639ad2674414610127576100c9565b806342f1181e146100ce578063494503d4146100e3575b600080fd5b6100e16100dc366004610f27565b6101ca565b005b6100f66100f1366004611160565b6101de565b6040516101039190611190565b60405180910390f35b6100e161011a366004610f27565b610212565b6100f66102cc565b6100e1610135366004611032565b6102e8565b6100e16101483660046110f2565b6102fa565b6101556104f6565b60405161010391906112c5565b610175610170366004610f27565b61051b565b60405161010391906112ba565b61018a610530565b6040516101039190611261565b6100e16101a5366004610f27565b61059f565b6101bd6101b836600461109d565b610642565b6040516101039190611390565b6101d26106bc565b6101db81610705565b50565b600281815481106101eb57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61021a6106bc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166102585761025861025382610836565b6108d5565b60005b6002548110156102c8578173ffffffffffffffffffffffffffffffffffffffff166002828154811061028957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156102c0576102bb82826108dd565b6102c8565b60010161025b565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6102f06106bc565b6102c882826108dd565b610302610b2c565b60008060606103566004898990508a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516103699190810190610f5f565b925092509250600061037b8487610b8d565b905060008373ffffffffffffffffffffffffffffffffffffffff1663c2df82e6868a8a8a886040518663ffffffff1660e01b81526004016103c09594939291906111d8565b602060405180830381600087803b1580156103da57600080fd5b505af11580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610412919081019061105d565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167fdc1600f30000000000000000000000000000000000000000000000000000000014610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611322565b60405180910390fd5b6104a28588610b8d565b6104b2838863ffffffff610c3916565b11156104ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611359565b50505050505050505050565b7fdc1600f3000000000000000000000000000000000000000000000000000000005b90565b60016020526000908152604090205460ff1681565b6060600280548060200260200160405190810160405280929190818152602001828054801561059557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161056a575b5050505050905090565b6105a76106bc565b73ffffffffffffffffffffffffffffffffffffffff81166105d2576105cd610253610c55565b6101db565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60008061069460048686905087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516106a79190810190610f43565b90506106b38184610b8d565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610703576000546107039061025390339073ffffffffffffffffffffffffffffffffffffffff16610c8c565b565b73ffffffffffffffffffffffffffffffffffffffff811661072b5761072b610253610d2e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156107655761076561025382610d65565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b606063eb5108a260e01b826040516024016108519190611190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff166109165761091661025383610836565b60025481106109315761093161025382600280549050610d80565b8173ffffffffffffffffffffffffffffffffffffffff166002828154811061095557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16146109b7576109b76102536002838154811061098f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684610d9d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610a3257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610a6557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610ae49082610e99565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b3360009081526001602052604090205460ff166107035761070361025333610dba565b606081831115610b6857610b6861025360008585610dd5565b8351821115610b8157610b816102536001848751610dd5565b50819003910190815290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610be2908590600401611190565b60206040518083038186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c329190810190611178565b9392505050565b600082820183811015610c3257610c3261025360008686610e7a565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b6060631de45ad160e01b8383604051602401610ca99291906111b1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b826040516024016108519190611190565b606063e9f8377160e01b8383604051602401610ca9929190611399565b606063140a84db60e01b8383604051602401610ca99291906111b1565b606063b65a25b960e01b826040516024016108519190611190565b6060632800659560e01b848484604051602401610df493929190611314565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063e946c1bb60e01b848484604051602401610df4939291906112f2565b815481835581811115610ebd57600083815260209020610ebd918101908301610ec2565b505050565b61051891905b80821115610edc5760008155600101610ec8565b5090565b60008083601f840112610ef1578182fd5b50813567ffffffffffffffff811115610f08578182fd5b602083019150836020828501011115610f2057600080fd5b9250929050565b600060208284031215610f38578081fd5b8135610c32816113fe565b600060208284031215610f54578081fd5b8151610c32816113fe565b600080600060608486031215610f73578182fd5b8351610f7e816113fe565b6020850151909350610f8f816113fe565b604085015190925067ffffffffffffffff80821115610fac578283fd5b81860187601f820112610fbd578384fd5b8051925081831115610fcd578384fd5b610ffe60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116016113a7565b9150828252876020848301011115611014578384fd5b6110258360208401602084016113ce565b5080925050509250925092565b60008060408385031215611044578182fd5b823561104f816113fe565b946020939093013593505050565b60006020828403121561106e578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c32578182fd5b6000806000604084860312156110b1578283fd5b833567ffffffffffffffff8111156110c7578384fd5b6110d386828701610ee0565b90945092505060208401356110e7816113fe565b809150509250925092565b600080600080600060808688031215611109578081fd5b853567ffffffffffffffff81111561111f578182fd5b61112b88828901610ee0565b909650945050602086013561113f816113fe565b9250604086013561114f816113fe565b949793965091946060013592915050565b600060208284031215611171578081fd5b5035919050565b600060208284031215611189578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015280861660408401525083606083015260a0608083015282518060a084015261122b8160c08501602087016113ce565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160c0019695505050505050565b602080825282518282018190526000918401906040840190835b818110156112af57835173ffffffffffffffffffffffffffffffffffffffff1683526020938401939092019160010161127b565b509095945050505050565b901515815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b606081016004851061130057fe5b938152602081019290925260409091015290565b606081016008851061130057fe5b6020808252600d908201527f4252494447455f4641494c454400000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f4252494447455f554e4445525041590000000000000000000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156113c657600080fd5b604052919050565b60005b838110156113e95781810151838201526020016113d1565b838111156113f8576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff811681146101db57600080fdfea365627a7a723158208443fe55d18b7dc9cff24ff524db866409ee96cb967c5e055d122b01700b898d6c6578706572696d656e74616cf564736f6c634300050c0040'; + /** + * Authorizes an address. + */ + public addAuthorizedAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param target Address to authorize. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param target Address to authorize. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param target Address to authorize. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param target Address to authorize. + */ + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('target', target); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param target Address to authorize. + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string): string { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public authorities = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isBigNumber('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public authorized = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + /** + * Retrieves the balance of `owner` for this asset. + */ + public balanceOf = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @returns balance The balance of the ERC20 token being transferred by this asset proxy. + */ + async callAsync( + assetData: string, + owner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('assetData', assetData); + assert.isString('owner', owner); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('balanceOf(bytes,address)', [ + assetData, + owner.toLowerCase(), + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('balanceOf(bytes,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + /** + * Gets all authorized addresses. + */ + public getAuthorizedAddresses = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @returns Array of authorized addresses. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + /** + * Gets the proxy id associated with this asset proxy. + */ + public getProxyId = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @returns proxyId The proxy id. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('getProxyId()', []); + const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex'); + + let rawCallResult; + try { + rawCallResult = await self._evmExecAsync(encodedDataBytes); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public owner = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('owner()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('owner()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + /** + * Removes authorizion of an address. + */ + public removeAuthorizedAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param target Address to remove authorization from. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param target Address to remove authorization from. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param target Address to remove authorization from. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param target Address to remove authorization from. + */ + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('target', target); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param target Address to remove authorization from. + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string): string { + assert.isString('target', target); + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + /** + * Removes authorizion of an address. + */ + public removeAuthorizedAddressAtIndex = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param target Address to remove authorization from. + * @param index Index of target in authorities array. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + index: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param target Address to remove authorization from. + * @param index Index of target in authorities array. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + index: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20BridgeProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param target Address to remove authorization from. + * @param index Index of target in authorities array. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + target: string, + index: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param target Address to remove authorization from. + * @param index Index of target in authorities array. + */ + async callAsync( + target: string, + index: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param target Address to remove authorization from. + * @param index Index of target in authorities array. + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string, index: BigNumber): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + /** + * Calls a bridge contract to transfer `amount` of ERC20 from `from` + * to `to`. Asserts that the balance of `to` has increased by `amount`. + */ + public transferFrom = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param assetData Abi-encoded data for this asset proxy encoded as: + * abi.encodeWithSelector( bytes4 PROXY_ID, address + * tokenAddress, address bridgeAddress, bytes + * bridgeData ) + * @param from Address to transfer asset from. + * @param to Address to transfer asset to. + * @param amount Amount of asset to transfer. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + assetData: string, + from: string, + to: string, + amount: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(assetData, from, to, amount, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param assetData Abi-encoded data for this asset proxy encoded as: + * abi.encodeWithSelector( bytes4 PROXY_ID, address + * tokenAddress, address bridgeAddress, bytes + * bridgeData ) + * @param from Address to transfer asset from. + * @param to Address to transfer asset to. + * @param amount Amount of asset to transfer. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + assetData: string, + from: string, + to: string, + amount: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as ERC20BridgeProxyContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param assetData Abi-encoded data for this asset proxy encoded as: + * abi.encodeWithSelector( bytes4 PROXY_ID, address + * tokenAddress, address bridgeAddress, bytes + * bridgeData ) + * @param from Address to transfer asset from. + * @param to Address to transfer asset to. + * @param amount Amount of asset to transfer. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + assetData: string, + from: string, + to: string, + amount: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param assetData Abi-encoded data for this asset proxy encoded as: + * abi.encodeWithSelector( bytes4 PROXY_ID, address + * tokenAddress, address bridgeAddress, bytes + * bridgeData ) + * @param from Address to transfer asset from. + * @param to Address to transfer asset to. + * @param amount Amount of asset to transfer. + */ + async callAsync( + assetData: string, + from: string, + to: string, + amount: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param assetData Abi-encoded data for this asset proxy encoded as: + * abi.encodeWithSelector( bytes4 PROXY_ID, address + * tokenAddress, address bridgeAddress, bytes + * bridgeData ) + * @param from Address to transfer asset from. + * @param to Address to transfer asset to. + * @param amount Amount of asset to transfer. + * @returns The ABI encoded transaction data as a 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 ERC20BridgeProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'transferFrom(bytes,address,address,uint256)', + [assetData, from.toLowerCase(), to.toLowerCase(), amount], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + public transferOwnership = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + newOwner: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20BridgeProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('newOwner', newOwner); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ERC20BridgeProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(newOwner: string): string { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20BridgeProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, + }; + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( + artifact: ContractArtifact | SimpleContractArtifact, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + ): Promise { + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (artifact.compilerOutput === undefined) { + throw new Error('Compiler output not found in the artifact file'); + } + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const bytecode = artifact.compilerOutput.evm.bytecode.object; + const abi = artifact.compilerOutput.abi; + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + if (Object.keys(logDecodeDependencies) !== undefined) { + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } + } + return ERC20BridgeProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + } + public static async deployAsync( + bytecode: string, + abi: ContractAbi, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractAbi }, + ): Promise { + assert.isHexString('bytecode', bytecode); + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const constructorAbi = BaseContract._lookupConstructorAbi(abi); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + const iface = new ethers.utils.Interface(abi); + const deployInfo = iface.deployFunction; + const txData = deployInfo.encode(bytecode, []); + const web3Wrapper = new Web3Wrapper(provider); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { data: txData }, + txDefaults, + web3Wrapper.estimateGasAsync.bind(web3Wrapper), + ); + const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); + logUtils.log(`transactionHash: ${txHash}`); + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); + logUtils.log(`ERC20BridgeProxy successfully deployed at ${txReceipt.contractAddress}`); + const contractInstance = new ERC20BridgeProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = []; + return contractInstance; + } + + /** + * @returns The contract ABI + */ + public static ABI(): ContractAbi { + const abi = [ + { + anonymous: false, + inputs: [ + { + name: 'target', + type: 'address', + indexed: true, + }, + { + name: 'caller', + type: 'address', + indexed: true, + }, + ], + name: 'AuthorizedAddressAdded', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'target', + type: 'address', + indexed: true, + }, + { + name: 'caller', + type: 'address', + indexed: true, + }, + ], + name: 'AuthorizedAddressRemoved', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'previousOwner', + type: 'address', + indexed: true, + }, + { + name: 'newOwner', + type: 'address', + indexed: true, + }, + ], + name: 'OwnershipTransferred', + outputs: [], + type: 'event', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + ], + name: 'addAuthorizedAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'uint256', + }, + ], + name: 'authorities', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'address', + }, + ], + name: 'authorized', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'assetData', + type: 'bytes', + }, + { + name: 'owner', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + name: 'balance', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getAuthorizedAddresses', + outputs: [ + { + name: '', + type: 'address[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getProxyId', + outputs: [ + { + name: 'proxyId', + type: 'bytes4', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'owner', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + ], + name: 'removeAuthorizedAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + { + name: 'index', + type: 'uint256', + }, + ], + name: 'removeAuthorizedAddressAtIndex', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'assetData', + type: 'bytes', + }, + { + name: 'from', + type: 'address', + }, + { + name: 'to', + type: 'address', + }, + { + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + ] as ContractAbi; + return abi; + } + /** + * Subscribe to an event type emitted by the ERC20BridgeProxy contract. + * @param eventName The ERC20BridgeProxy contract event you would like to subscribe to. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` + * @param callback Callback that gets called when a log is added/removed + * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) + * @return Subscription token used later to unsubscribe + */ + public subscribe( + eventName: ERC20BridgeProxyEvents, + indexFilterValues: IndexedFilterValues, + callback: EventCallback, + isVerbose: boolean = false, + blockPollingIntervalMs?: number, + ): string { + assert.doesBelongToStringEnum('eventName', eventName, ERC20BridgeProxyEvents); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); + assert.isFunction('callback', callback); + const subscriptionToken = this._subscriptionManager.subscribe( + this.address, + eventName, + indexFilterValues, + ERC20BridgeProxyContract.ABI(), + callback, + isVerbose, + blockPollingIntervalMs, + ); + return subscriptionToken; + } + /** + * Cancel a subscription + * @param subscriptionToken Subscription token returned by `subscribe()` + */ + public unsubscribe(subscriptionToken: string): void { + this._subscriptionManager.unsubscribe(subscriptionToken); + } + /** + * Cancels all existing subscriptions + */ + public unsubscribeAll(): void { + this._subscriptionManager.unsubscribeAll(); + } + /** + * Gets historical logs without creating a subscription + * @param eventName The ERC20BridgeProxy contract event you would like to subscribe to. + * @param blockRange Block range to get logs from. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` + * @return Array of logs that match the parameters + */ + public async getLogsAsync( + eventName: ERC20BridgeProxyEvents, + blockRange: BlockRange, + indexFilterValues: IndexedFilterValues, + ): Promise>> { + assert.doesBelongToStringEnum('eventName', eventName, ERC20BridgeProxyEvents); + assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); + const logs = await this._subscriptionManager.getLogsAsync( + this.address, + eventName, + blockRange, + indexFilterValues, + ERC20BridgeProxyContract.ABI(), + ); + return logs; + } + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + deployedBytecode: string | undefined = ERC20BridgeProxyContract.deployedBytecode, + ) { + super( + 'ERC20BridgeProxy', + ERC20BridgeProxyContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + deployedBytecode, + ); + classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); + this._subscriptionManager = new SubscriptionManager( + ERC20BridgeProxyContract.ABI(), + this._web3Wrapper, + ); + } +} + +// tslint:disable:max-file-line-count +// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align +// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts b/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts index 8f844b9780..74c0635907 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts @@ -1195,7 +1195,7 @@ export class StakingContract extends BaseContract { name: 'getWethContract', outputs: [ { - name: 'wethContract', + name: '', type: 'address', }, ], @@ -1533,6 +1533,34 @@ export class StakingContract extends BaseContract { stateMutability: 'view', type: 'function', }, + { + constant: true, + inputs: [], + name: 'testWethAddress', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'testZrxVaultAddress', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, { constant: false, inputs: [ diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts b/packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts new file mode 100644 index 0000000000..cbd649ee5f --- /dev/null +++ b/packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts @@ -0,0 +1,6585 @@ +// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming +// tslint:disable:whitespace no-unbound-method no-trailing-whitespace +// tslint:disable:no-unused-variable +import { BaseContract, SubscriptionManager, PromiseWithTransactionHash } from '@0x/base-contract'; +import { schemas } from '@0x/json-schemas'; +import { + BlockParam, + BlockParamLiteral, + BlockRange, + CallData, + ContractAbi, + ContractArtifact, + DecodedLogArgs, + LogWithDecodedArgs, + MethodAbi, + TransactionReceiptWithDecodedLogs, + TxData, + TxDataPayable, + SupportedProvider, +} from 'ethereum-types'; +import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; +import { Web3Wrapper } from '@0x/web3-wrapper'; +import { assert } from '@0x/assert'; +import * as ethers from 'ethers'; +// tslint:enable:no-unused-variable + +export type TestStakingEventArgs = + | TestStakingAuthorizedAddressAddedEventArgs + | TestStakingAuthorizedAddressRemovedEventArgs + | TestStakingEpochEndedEventArgs + | TestStakingEpochFinalizedEventArgs + | TestStakingExchangeAddedEventArgs + | TestStakingExchangeRemovedEventArgs + | TestStakingMakerStakingPoolSetEventArgs + | TestStakingMoveStakeEventArgs + | TestStakingOperatorShareDecreasedEventArgs + | TestStakingOwnershipTransferredEventArgs + | TestStakingParamsSetEventArgs + | TestStakingRewardsPaidEventArgs + | TestStakingStakeEventArgs + | TestStakingStakingPoolCreatedEventArgs + | TestStakingStakingPoolEarnedRewardsInEpochEventArgs + | TestStakingUnstakeEventArgs; + +export enum TestStakingEvents { + AuthorizedAddressAdded = 'AuthorizedAddressAdded', + AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', + EpochEnded = 'EpochEnded', + EpochFinalized = 'EpochFinalized', + ExchangeAdded = 'ExchangeAdded', + ExchangeRemoved = 'ExchangeRemoved', + MakerStakingPoolSet = 'MakerStakingPoolSet', + MoveStake = 'MoveStake', + OperatorShareDecreased = 'OperatorShareDecreased', + OwnershipTransferred = 'OwnershipTransferred', + ParamsSet = 'ParamsSet', + RewardsPaid = 'RewardsPaid', + Stake = 'Stake', + StakingPoolCreated = 'StakingPoolCreated', + StakingPoolEarnedRewardsInEpoch = 'StakingPoolEarnedRewardsInEpoch', + Unstake = 'Unstake', +} + +export interface TestStakingAuthorizedAddressAddedEventArgs extends DecodedLogArgs { + target: string; + caller: string; +} + +export interface TestStakingAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { + target: string; + caller: string; +} + +export interface TestStakingEpochEndedEventArgs extends DecodedLogArgs { + epoch: BigNumber; + numPoolsToFinalize: BigNumber; + rewardsAvailable: BigNumber; + totalFeesCollected: BigNumber; + totalWeightedStake: BigNumber; +} + +export interface TestStakingEpochFinalizedEventArgs extends DecodedLogArgs { + epoch: BigNumber; + rewardsPaid: BigNumber; + rewardsRemaining: BigNumber; +} + +export interface TestStakingExchangeAddedEventArgs extends DecodedLogArgs { + exchangeAddress: string; +} + +export interface TestStakingExchangeRemovedEventArgs extends DecodedLogArgs { + exchangeAddress: string; +} + +export interface TestStakingMakerStakingPoolSetEventArgs extends DecodedLogArgs { + makerAddress: string; + poolId: string; +} + +export interface TestStakingMoveStakeEventArgs extends DecodedLogArgs { + staker: string; + amount: BigNumber; + fromStatus: number; + fromPool: string; + toStatus: number; + toPool: string; +} + +export interface TestStakingOperatorShareDecreasedEventArgs extends DecodedLogArgs { + poolId: string; + oldOperatorShare: number; + newOperatorShare: number; +} + +export interface TestStakingOwnershipTransferredEventArgs extends DecodedLogArgs { + previousOwner: string; + newOwner: string; +} + +export interface TestStakingParamsSetEventArgs extends DecodedLogArgs { + epochDurationInSeconds: BigNumber; + rewardDelegatedStakeWeight: number; + minimumPoolStake: BigNumber; + cobbDouglasAlphaNumerator: BigNumber; + cobbDouglasAlphaDenominator: BigNumber; +} + +export interface TestStakingRewardsPaidEventArgs extends DecodedLogArgs { + epoch: BigNumber; + poolId: string; + operatorReward: BigNumber; + membersReward: BigNumber; +} + +export interface TestStakingStakeEventArgs extends DecodedLogArgs { + staker: string; + amount: BigNumber; +} + +export interface TestStakingStakingPoolCreatedEventArgs extends DecodedLogArgs { + poolId: string; + operator: string; + operatorShare: number; +} + +export interface TestStakingStakingPoolEarnedRewardsInEpochEventArgs extends DecodedLogArgs { + epoch: BigNumber; + poolId: string; +} + +export interface TestStakingUnstakeEventArgs extends DecodedLogArgs { + staker: string; + amount: BigNumber; +} + +/* istanbul ignore next */ +// tslint:disable:no-parameter-reassignment +// tslint:disable-next-line:class-name +export class TestStakingContract extends BaseContract { + /** + * @ignore + */ + public static deployedBytecode: string | undefined; + public addAuthorizedAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('target', target); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string): string { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public addExchangeAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + addr: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('addExchangeAddress(address)', [addr.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.addExchangeAddress.callAsync(addr, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + addr: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.addExchangeAddress.sendTransactionAsync(addr.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(addr: string, txData?: Partial | undefined): Promise { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('addExchangeAddress(address)', [addr.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(addr: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('addr', addr); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('addExchangeAddress(address)', [addr.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('addExchangeAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(addr: string): string { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addExchangeAddress(address)', [ + addr.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('addExchangeAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public aggregatedStatsByEpoch = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]> { + assert.isBigNumber('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('aggregatedStatsByEpoch(uint256)', [index_0]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('aggregatedStatsByEpoch(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]>( + rawCallResult, + ); + // tslint:enable boolean-naming + return result; + }, + }; + public authorities = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isBigNumber('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public authorized = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public cobbDouglasAlphaDenominator = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('cobbDouglasAlphaDenominator()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('cobbDouglasAlphaDenominator()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public cobbDouglasAlphaNumerator = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('cobbDouglasAlphaNumerator()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('cobbDouglasAlphaNumerator()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public computeRewardBalanceOfDelegator = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + poolId: string, + member: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('poolId', poolId); + assert.isString('member', member); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('computeRewardBalanceOfDelegator(bytes32,address)', [ + poolId, + member.toLowerCase(), + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('computeRewardBalanceOfDelegator(bytes32,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public computeRewardBalanceOfOperator = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + poolId: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('computeRewardBalanceOfOperator(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('computeRewardBalanceOfOperator(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public createStakingPool = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + operatorShare: number | BigNumber, + addOperatorAsMaker: boolean, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isNumberOrBigNumber('operatorShare', operatorShare); + assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ + operatorShare, + addOperatorAsMaker, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.createStakingPool.callAsync(operatorShare, addOperatorAsMaker, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + operatorShare: number | BigNumber, + addOperatorAsMaker: boolean, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isNumberOrBigNumber('operatorShare', operatorShare); + assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.createStakingPool.sendTransactionAsync( + operatorShare, + addOperatorAsMaker, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + operatorShare: number | BigNumber, + addOperatorAsMaker: boolean, + txData?: Partial | undefined, + ): Promise { + assert.isNumberOrBigNumber('operatorShare', operatorShare); + assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ + operatorShare, + addOperatorAsMaker, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + operatorShare: number | BigNumber, + addOperatorAsMaker: boolean, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isNumberOrBigNumber('operatorShare', operatorShare); + assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ + operatorShare, + addOperatorAsMaker, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('createStakingPool(uint32,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(operatorShare: number | BigNumber, addOperatorAsMaker: boolean): string { + assert.isNumberOrBigNumber('operatorShare', operatorShare); + assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ + operatorShare, + addOperatorAsMaker, + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('createStakingPool(uint32,bool)'); + return abiEncoder.getSelector(); + }, + }; + public currentEpoch = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('currentEpoch()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('currentEpoch()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public currentEpochStartTimeInSeconds = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('currentEpochStartTimeInSeconds()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('currentEpochStartTimeInSeconds()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public decreaseStakingPoolOperatorShare = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + poolId: string, + newOperatorShare: number | BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('poolId', poolId); + assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('decreaseStakingPoolOperatorShare(bytes32,uint32)', [ + poolId, + newOperatorShare, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.decreaseStakingPoolOperatorShare.callAsync(poolId, newOperatorShare, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + poolId: string, + newOperatorShare: number | BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('poolId', poolId); + assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.decreaseStakingPoolOperatorShare.sendTransactionAsync( + poolId, + newOperatorShare, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + poolId: string, + newOperatorShare: number | BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('poolId', poolId); + assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('decreaseStakingPoolOperatorShare(bytes32,uint32)', [ + poolId, + newOperatorShare, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + poolId: string, + newOperatorShare: number | BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('poolId', poolId); + assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('decreaseStakingPoolOperatorShare(bytes32,uint32)', [ + poolId, + newOperatorShare, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('decreaseStakingPoolOperatorShare(bytes32,uint32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(poolId: string, newOperatorShare: number | BigNumber): string { + assert.isString('poolId', poolId); + assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'decreaseStakingPoolOperatorShare(bytes32,uint32)', + [poolId, newOperatorShare], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('decreaseStakingPoolOperatorShare(bytes32,uint32)'); + return abiEncoder.getSelector(); + }, + }; + public endEpoch = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('endEpoch()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.endEpoch.callAsync(txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + const self = (this as any) as TestStakingContract; + const txHashPromise = self.endEpoch.sendTransactionAsync(txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('endEpoch()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('endEpoch()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('endEpoch()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('endEpoch()', []); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('endEpoch()'); + return abiEncoder.getSelector(); + }, + }; + public epochDurationInSeconds = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('epochDurationInSeconds()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('epochDurationInSeconds()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public finalizePool = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + poolId: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.finalizePool.callAsync(poolId, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + poolId: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.finalizePool.sendTransactionAsync(poolId, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(poolId: string, txData?: Partial | undefined): Promise { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(poolId: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('finalizePool(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(poolId: string): string { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('finalizePool(bytes32)'); + return abiEncoder.getSelector(); + }, + }; + public getAuthorizedAddresses = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getCurrentEpochEarliestEndTimeInSeconds = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getCurrentEpochEarliestEndTimeInSeconds()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getCurrentEpochEarliestEndTimeInSeconds()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getGlobalStakeByStatus = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + stakeStatus: number | BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { + assert.isNumberOrBigNumber('stakeStatus', stakeStatus); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getGlobalStakeByStatus(uint8)', [stakeStatus]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getGlobalStakeByStatus(uint8)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{ + currentEpoch: BigNumber; + currentEpochBalance: BigNumber; + nextEpochBalance: BigNumber; + }>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getOwnerStakeByStatus = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + stakeStatus: number | BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { + assert.isString('staker', staker); + assert.isNumberOrBigNumber('stakeStatus', stakeStatus); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getOwnerStakeByStatus(address,uint8)', [ + staker.toLowerCase(), + stakeStatus, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getOwnerStakeByStatus(address,uint8)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{ + currentEpoch: BigNumber; + currentEpochBalance: BigNumber; + nextEpochBalance: BigNumber; + }>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getParams = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[BigNumber, number, BigNumber, number, number]> { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getParams()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getParams()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, number, BigNumber, number, number]>( + rawCallResult, + ); + // tslint:enable boolean-naming + return result; + }, + }; + public getStakeDelegatedToPoolByOwner = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + poolId: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { + assert.isString('staker', staker); + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getStakeDelegatedToPoolByOwner(address,bytes32)', [ + staker.toLowerCase(), + poolId, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getStakeDelegatedToPoolByOwner(address,bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{ + currentEpoch: BigNumber; + currentEpochBalance: BigNumber; + nextEpochBalance: BigNumber; + }>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getStakingPool = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + poolId: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<{ operator: string; operatorShare: number }> { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getStakingPool(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getStakingPool(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{ operator: string; operatorShare: number }>( + rawCallResult, + ); + // tslint:enable boolean-naming + return result; + }, + }; + public getStakingPoolStatsThisEpoch = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + poolId: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<{ feesCollected: BigNumber; weightedStake: BigNumber; membersStake: BigNumber }> { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getStakingPoolStatsThisEpoch(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getStakingPoolStatsThisEpoch(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{ + feesCollected: BigNumber; + weightedStake: BigNumber; + membersStake: BigNumber; + }>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getTotalStake = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('staker', staker); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getTotalStake(address)', [staker.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getTotalStake(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getTotalStakeDelegatedToPool = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + poolId: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getTotalStakeDelegatedToPool(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getTotalStakeDelegatedToPool(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{ + currentEpoch: BigNumber; + currentEpochBalance: BigNumber; + nextEpochBalance: BigNumber; + }>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getWethContract = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getWethContract()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getWethContract()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public getZrxVault = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('getZrxVault()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getZrxVault()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public init = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('init()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.init.callAsync(txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + const self = (this as any) as TestStakingContract; + const txHashPromise = self.init.sendTransactionAsync(txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('init()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('init()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('init()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('init()', []); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('init()'); + return abiEncoder.getSelector(); + }, + }; + public joinStakingPoolAsMaker = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + poolId: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.joinStakingPoolAsMaker.callAsync(poolId, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + poolId: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.joinStakingPoolAsMaker.sendTransactionAsync(poolId, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(poolId: string, txData?: Partial | undefined): Promise { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(poolId: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('joinStakingPoolAsMaker(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(poolId: string): string { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('joinStakingPoolAsMaker(bytes32)'); + return abiEncoder.getSelector(); + }, + }; + public lastPoolId = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('lastPoolId()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('lastPoolId()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public minimumPoolStake = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('minimumPoolStake()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('minimumPoolStake()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public moveStake = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + from: { status: number | BigNumber; poolId: string }, + to: { status: number | BigNumber; poolId: string }, + amount: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('moveStake((uint8,bytes32),(uint8,bytes32),uint256)', [ + from, + to, + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.moveStake.callAsync(from, to, amount, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + from: { status: number | BigNumber; poolId: string }, + to: { status: number | BigNumber; poolId: string }, + amount: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.moveStake.sendTransactionAsync(from, to, amount, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + from: { status: number | BigNumber; poolId: string }, + to: { status: number | BigNumber; poolId: string }, + amount: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('moveStake((uint8,bytes32),(uint8,bytes32),uint256)', [ + from, + to, + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + from: { status: number | BigNumber; poolId: string }, + to: { status: number | BigNumber; poolId: string }, + amount: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isBigNumber('amount', amount); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('moveStake((uint8,bytes32),(uint8,bytes32),uint256)', [ + from, + to, + amount, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('moveStake((uint8,bytes32),(uint8,bytes32),uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData( + from: { status: number | BigNumber; poolId: string }, + to: { status: number | BigNumber; poolId: string }, + amount: BigNumber, + ): string { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'moveStake((uint8,bytes32),(uint8,bytes32),uint256)', + [from, to, amount], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('moveStake((uint8,bytes32),(uint8,bytes32),uint256)'); + return abiEncoder.getSelector(); + }, + }; + public owner = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('owner()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('owner()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public payProtocolFee = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + makerAddress: string, + payerAddress: string, + protocolFee: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('makerAddress', makerAddress); + assert.isString('payerAddress', payerAddress); + assert.isBigNumber('protocolFee', protocolFee); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ + makerAddress.toLowerCase(), + payerAddress.toLowerCase(), + protocolFee, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.payProtocolFee.callAsync(makerAddress, payerAddress, protocolFee, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + makerAddress: string, + payerAddress: string, + protocolFee: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('makerAddress', makerAddress); + assert.isString('payerAddress', payerAddress); + assert.isBigNumber('protocolFee', protocolFee); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.payProtocolFee.sendTransactionAsync( + makerAddress.toLowerCase(), + payerAddress.toLowerCase(), + protocolFee, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + makerAddress: string, + payerAddress: string, + protocolFee: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('makerAddress', makerAddress); + assert.isString('payerAddress', payerAddress); + assert.isBigNumber('protocolFee', protocolFee); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ + makerAddress.toLowerCase(), + payerAddress.toLowerCase(), + protocolFee, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + makerAddress: string, + payerAddress: string, + protocolFee: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('makerAddress', makerAddress); + assert.isString('payerAddress', payerAddress); + assert.isBigNumber('protocolFee', protocolFee); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ + makerAddress.toLowerCase(), + payerAddress.toLowerCase(), + protocolFee, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('payProtocolFee(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(makerAddress: string, payerAddress: string, protocolFee: BigNumber): string { + assert.isString('makerAddress', makerAddress); + assert.isString('payerAddress', payerAddress); + assert.isBigNumber('protocolFee', protocolFee); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ + makerAddress.toLowerCase(), + payerAddress.toLowerCase(), + protocolFee, + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('payProtocolFee(address,address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + public poolIdByMaker = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('poolIdByMaker(address)', [index_0.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('poolIdByMaker(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public poolStatsByEpoch = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: string, + index_1: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[BigNumber, BigNumber, BigNumber]> { + assert.isString('index_0', index_0); + assert.isBigNumber('index_1', index_1); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('poolStatsByEpoch(bytes32,uint256)', [index_0, index_1]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('poolStatsByEpoch(bytes32,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber, BigNumber]>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public removeAuthorizedAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('target', target); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string): string { + assert.isString('target', target); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public removeAuthorizedAddressAtIndex = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + index: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + index: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + target: string, + index: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + target: string, + index: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string, index: BigNumber): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + public removeExchangeAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + addr: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeExchangeAddress(address)', [addr.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeExchangeAddress.callAsync(addr, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + addr: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.removeExchangeAddress.sendTransactionAsync(addr.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(addr: string, txData?: Partial | undefined): Promise { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeExchangeAddress(address)', [addr.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(addr: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('addr', addr); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('removeExchangeAddress(address)', [addr.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeExchangeAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(addr: string): string { + assert.isString('addr', addr); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeExchangeAddress(address)', [ + addr.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('removeExchangeAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public rewardDelegatedStakeWeight = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('rewardDelegatedStakeWeight()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('rewardDelegatedStakeWeight()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public rewardsByPoolId = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('rewardsByPoolId(bytes32)', [index_0]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('rewardsByPoolId(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public setParams = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + _epochDurationInSeconds: BigNumber, + _rewardDelegatedStakeWeight: number | BigNumber, + _minimumPoolStake: BigNumber, + _cobbDouglasAlphaNumerator: number | BigNumber, + _cobbDouglasAlphaDenominator: number | BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); + assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); + assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); + assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); + assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setParams(uint256,uint32,uint256,uint32,uint32)', [ + _epochDurationInSeconds, + _rewardDelegatedStakeWeight, + _minimumPoolStake, + _cobbDouglasAlphaNumerator, + _cobbDouglasAlphaDenominator, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.setParams.callAsync( + _epochDurationInSeconds, + _rewardDelegatedStakeWeight, + _minimumPoolStake, + _cobbDouglasAlphaNumerator, + _cobbDouglasAlphaDenominator, + txDataWithDefaults, + ); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + _epochDurationInSeconds: BigNumber, + _rewardDelegatedStakeWeight: number | BigNumber, + _minimumPoolStake: BigNumber, + _cobbDouglasAlphaNumerator: number | BigNumber, + _cobbDouglasAlphaDenominator: number | BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); + assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); + assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); + assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); + assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.setParams.sendTransactionAsync( + _epochDurationInSeconds, + _rewardDelegatedStakeWeight, + _minimumPoolStake, + _cobbDouglasAlphaNumerator, + _cobbDouglasAlphaDenominator, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + _epochDurationInSeconds: BigNumber, + _rewardDelegatedStakeWeight: number | BigNumber, + _minimumPoolStake: BigNumber, + _cobbDouglasAlphaNumerator: number | BigNumber, + _cobbDouglasAlphaDenominator: number | BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); + assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); + assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); + assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); + assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setParams(uint256,uint32,uint256,uint32,uint32)', [ + _epochDurationInSeconds, + _rewardDelegatedStakeWeight, + _minimumPoolStake, + _cobbDouglasAlphaNumerator, + _cobbDouglasAlphaDenominator, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + _epochDurationInSeconds: BigNumber, + _rewardDelegatedStakeWeight: number | BigNumber, + _minimumPoolStake: BigNumber, + _cobbDouglasAlphaNumerator: number | BigNumber, + _cobbDouglasAlphaDenominator: number | BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); + assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); + assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); + assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); + assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setParams(uint256,uint32,uint256,uint32,uint32)', [ + _epochDurationInSeconds, + _rewardDelegatedStakeWeight, + _minimumPoolStake, + _cobbDouglasAlphaNumerator, + _cobbDouglasAlphaDenominator, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('setParams(uint256,uint32,uint256,uint32,uint32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData( + _epochDurationInSeconds: BigNumber, + _rewardDelegatedStakeWeight: number | BigNumber, + _minimumPoolStake: BigNumber, + _cobbDouglasAlphaNumerator: number | BigNumber, + _cobbDouglasAlphaDenominator: number | BigNumber, + ): string { + assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); + assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); + assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); + assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); + assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'setParams(uint256,uint32,uint256,uint32,uint32)', + [ + _epochDurationInSeconds, + _rewardDelegatedStakeWeight, + _minimumPoolStake, + _cobbDouglasAlphaNumerator, + _cobbDouglasAlphaDenominator, + ], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('setParams(uint256,uint32,uint256,uint32,uint32)'); + return abiEncoder.getSelector(); + }, + }; + public setWethContract = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + wethAddress: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('wethAddress', wethAddress); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setWethContract(address)', [wethAddress.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.setWethContract.callAsync(wethAddress, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + wethAddress: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('wethAddress', wethAddress); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.setWethContract.sendTransactionAsync(wethAddress.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(wethAddress: string, txData?: Partial | undefined): Promise { + assert.isString('wethAddress', wethAddress); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setWethContract(address)', [wethAddress.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + wethAddress: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('wethAddress', wethAddress); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setWethContract(address)', [wethAddress.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('setWethContract(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(wethAddress: string): string { + assert.isString('wethAddress', wethAddress); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setWethContract(address)', [ + wethAddress.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('setWethContract(address)'); + return abiEncoder.getSelector(); + }, + }; + public setZrxVault = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + zrxVaultAddress: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('zrxVaultAddress', zrxVaultAddress); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setZrxVault(address)', [zrxVaultAddress.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.setZrxVault.callAsync(zrxVaultAddress, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + zrxVaultAddress: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('zrxVaultAddress', zrxVaultAddress); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.setZrxVault.sendTransactionAsync(zrxVaultAddress.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(zrxVaultAddress: string, txData?: Partial | undefined): Promise { + assert.isString('zrxVaultAddress', zrxVaultAddress); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setZrxVault(address)', [zrxVaultAddress.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + zrxVaultAddress: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('zrxVaultAddress', zrxVaultAddress); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('setZrxVault(address)', [zrxVaultAddress.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('setZrxVault(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(zrxVaultAddress: string): string { + assert.isString('zrxVaultAddress', zrxVaultAddress); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setZrxVault(address)', [ + zrxVaultAddress.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('setZrxVault(address)'); + return abiEncoder.getSelector(); + }, + }; + public stake = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + amount: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('stake(uint256)', [amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.stake.callAsync(amount, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + amount: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.stake.sendTransactionAsync(amount, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(amount: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('stake(uint256)', [amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isBigNumber('amount', amount); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('stake(uint256)', [amount]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('stake(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(amount: BigNumber): string { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('stake(uint256)', [amount]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('stake(uint256)'); + return abiEncoder.getSelector(); + }, + }; + public stakingContract = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('stakingContract()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('stakingContract()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public testWethAddress = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('testWethAddress()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('testWethAddress()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public testZrxVaultAddress = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('testZrxVaultAddress()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('testZrxVaultAddress()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public transferOwnership = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + newOwner: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('newOwner', newOwner); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('newOwner', newOwner); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(newOwner: string): string { + assert.isString('newOwner', newOwner); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, + }; + public unstake = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + amount: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('unstake(uint256)', [amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.unstake.callAsync(amount, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + amount: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.unstake.sendTransactionAsync(amount, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(amount: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('unstake(uint256)', [amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isBigNumber('amount', amount); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('unstake(uint256)', [amount]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('unstake(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(amount: BigNumber): string { + assert.isBigNumber('amount', amount); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('unstake(uint256)', [amount]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('unstake(uint256)'); + return abiEncoder.getSelector(); + }, + }; + public validExchanges = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('validExchanges(address)', [index_0.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('validExchanges(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public wethReservedForPoolRewards = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('wethReservedForPoolRewards()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('wethReservedForPoolRewards()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public withdrawDelegatorRewards = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + poolId: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [poolId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.withdrawDelegatorRewards.callAsync(poolId, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + poolId: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const txHashPromise = self.withdrawDelegatorRewards.sendTransactionAsync(poolId, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(poolId: string, txData?: Partial | undefined): Promise { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [poolId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(poolId: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('poolId', poolId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as TestStakingContract; + const encodedData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [poolId]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('withdrawDelegatorRewards(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(poolId: string): string { + assert.isString('poolId', poolId); + const self = (this as any) as TestStakingContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [ + poolId, + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestStakingContract; + const abiEncoder = self._lookupAbiEncoder('withdrawDelegatorRewards(bytes32)'); + return abiEncoder.getSelector(); + }, + }; + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( + artifact: ContractArtifact | SimpleContractArtifact, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + wethAddress: string, + zrxVaultAddress: string, + ): Promise { + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (artifact.compilerOutput === undefined) { + throw new Error('Compiler output not found in the artifact file'); + } + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const bytecode = artifact.compilerOutput.evm.bytecode.object; + const abi = artifact.compilerOutput.abi; + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + if (Object.keys(logDecodeDependencies) !== undefined) { + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } + } + return TestStakingContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + wethAddress, + zrxVaultAddress, + ); + } + public static async deployAsync( + bytecode: string, + abi: ContractAbi, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractAbi }, + wethAddress: string, + zrxVaultAddress: string, + ): Promise { + assert.isHexString('bytecode', bytecode); + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const constructorAbi = BaseContract._lookupConstructorAbi(abi); + [wethAddress, zrxVaultAddress] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [wethAddress, zrxVaultAddress], + BaseContract._bigNumberToString, + ); + const iface = new ethers.utils.Interface(abi); + const deployInfo = iface.deployFunction; + const txData = deployInfo.encode(bytecode, [wethAddress, zrxVaultAddress]); + const web3Wrapper = new Web3Wrapper(provider); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { data: txData }, + txDefaults, + web3Wrapper.estimateGasAsync.bind(web3Wrapper), + ); + const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); + logUtils.log(`transactionHash: ${txHash}`); + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); + logUtils.log(`TestStaking successfully deployed at ${txReceipt.contractAddress}`); + const contractInstance = new TestStakingContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [wethAddress, zrxVaultAddress]; + return contractInstance; + } + + /** + * @returns The contract ABI + */ + public static ABI(): ContractAbi { + const abi = [ + { + inputs: [ + { + name: 'wethAddress', + type: 'address', + }, + { + name: 'zrxVaultAddress', + type: 'address', + }, + ], + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + name: 'target', + type: 'address', + indexed: true, + }, + { + name: 'caller', + type: 'address', + indexed: true, + }, + ], + name: 'AuthorizedAddressAdded', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'target', + type: 'address', + indexed: true, + }, + { + name: 'caller', + type: 'address', + indexed: true, + }, + ], + name: 'AuthorizedAddressRemoved', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'epoch', + type: 'uint256', + indexed: true, + }, + { + name: 'numPoolsToFinalize', + type: 'uint256', + indexed: false, + }, + { + name: 'rewardsAvailable', + type: 'uint256', + indexed: false, + }, + { + name: 'totalFeesCollected', + type: 'uint256', + indexed: false, + }, + { + name: 'totalWeightedStake', + type: 'uint256', + indexed: false, + }, + ], + name: 'EpochEnded', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'epoch', + type: 'uint256', + indexed: true, + }, + { + name: 'rewardsPaid', + type: 'uint256', + indexed: false, + }, + { + name: 'rewardsRemaining', + type: 'uint256', + indexed: false, + }, + ], + name: 'EpochFinalized', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'exchangeAddress', + type: 'address', + indexed: false, + }, + ], + name: 'ExchangeAdded', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'exchangeAddress', + type: 'address', + indexed: false, + }, + ], + name: 'ExchangeRemoved', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'makerAddress', + type: 'address', + indexed: true, + }, + { + name: 'poolId', + type: 'bytes32', + indexed: true, + }, + ], + name: 'MakerStakingPoolSet', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'staker', + type: 'address', + indexed: true, + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + }, + { + name: 'fromStatus', + type: 'uint8', + indexed: false, + }, + { + name: 'fromPool', + type: 'bytes32', + indexed: true, + }, + { + name: 'toStatus', + type: 'uint8', + indexed: false, + }, + { + name: 'toPool', + type: 'bytes32', + indexed: true, + }, + ], + name: 'MoveStake', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + indexed: true, + }, + { + name: 'oldOperatorShare', + type: 'uint32', + indexed: false, + }, + { + name: 'newOperatorShare', + type: 'uint32', + indexed: false, + }, + ], + name: 'OperatorShareDecreased', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'previousOwner', + type: 'address', + indexed: true, + }, + { + name: 'newOwner', + type: 'address', + indexed: true, + }, + ], + name: 'OwnershipTransferred', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'epochDurationInSeconds', + type: 'uint256', + indexed: false, + }, + { + name: 'rewardDelegatedStakeWeight', + type: 'uint32', + indexed: false, + }, + { + name: 'minimumPoolStake', + type: 'uint256', + indexed: false, + }, + { + name: 'cobbDouglasAlphaNumerator', + type: 'uint256', + indexed: false, + }, + { + name: 'cobbDouglasAlphaDenominator', + type: 'uint256', + indexed: false, + }, + ], + name: 'ParamsSet', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'epoch', + type: 'uint256', + indexed: true, + }, + { + name: 'poolId', + type: 'bytes32', + indexed: true, + }, + { + name: 'operatorReward', + type: 'uint256', + indexed: false, + }, + { + name: 'membersReward', + type: 'uint256', + indexed: false, + }, + ], + name: 'RewardsPaid', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'staker', + type: 'address', + indexed: true, + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + }, + ], + name: 'Stake', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + indexed: false, + }, + { + name: 'operator', + type: 'address', + indexed: false, + }, + { + name: 'operatorShare', + type: 'uint32', + indexed: false, + }, + ], + name: 'StakingPoolCreated', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'epoch', + type: 'uint256', + indexed: true, + }, + { + name: 'poolId', + type: 'bytes32', + indexed: true, + }, + ], + name: 'StakingPoolEarnedRewardsInEpoch', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'staker', + type: 'address', + indexed: true, + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + }, + ], + name: 'Unstake', + outputs: [], + type: 'event', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + ], + name: 'addAuthorizedAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'addr', + type: 'address', + }, + ], + name: 'addExchangeAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'uint256', + }, + ], + name: 'aggregatedStatsByEpoch', + outputs: [ + { + name: 'rewardsAvailable', + type: 'uint256', + }, + { + name: 'numPoolsToFinalize', + type: 'uint256', + }, + { + name: 'totalFeesCollected', + type: 'uint256', + }, + { + name: 'totalWeightedStake', + type: 'uint256', + }, + { + name: 'totalRewardsFinalized', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'uint256', + }, + ], + name: 'authorities', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'address', + }, + ], + name: 'authorized', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'cobbDouglasAlphaDenominator', + outputs: [ + { + name: '', + type: 'uint32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'cobbDouglasAlphaNumerator', + outputs: [ + { + name: '', + type: 'uint32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + { + name: 'member', + type: 'address', + }, + ], + name: 'computeRewardBalanceOfDelegator', + outputs: [ + { + name: 'reward', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'computeRewardBalanceOfOperator', + outputs: [ + { + name: 'reward', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'operatorShare', + type: 'uint32', + }, + { + name: 'addOperatorAsMaker', + type: 'bool', + }, + ], + name: 'createStakingPool', + outputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'currentEpoch', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'currentEpochStartTimeInSeconds', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + { + name: 'newOperatorShare', + type: 'uint32', + }, + ], + name: 'decreaseStakingPoolOperatorShare', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'endEpoch', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'epochDurationInSeconds', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'finalizePool', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getAuthorizedAddresses', + outputs: [ + { + name: '', + type: 'address[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getCurrentEpochEarliestEndTimeInSeconds', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'stakeStatus', + type: 'uint8', + }, + ], + name: 'getGlobalStakeByStatus', + outputs: [ + { + name: 'balance', + type: 'tuple', + components: [ + { + name: 'currentEpoch', + type: 'uint64', + }, + { + name: 'currentEpochBalance', + type: 'uint96', + }, + { + name: 'nextEpochBalance', + type: 'uint96', + }, + ], + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'staker', + type: 'address', + }, + { + name: 'stakeStatus', + type: 'uint8', + }, + ], + name: 'getOwnerStakeByStatus', + outputs: [ + { + name: 'balance', + type: 'tuple', + components: [ + { + name: 'currentEpoch', + type: 'uint64', + }, + { + name: 'currentEpochBalance', + type: 'uint96', + }, + { + name: 'nextEpochBalance', + type: 'uint96', + }, + ], + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getParams', + outputs: [ + { + name: '_epochDurationInSeconds', + type: 'uint256', + }, + { + name: '_rewardDelegatedStakeWeight', + type: 'uint32', + }, + { + name: '_minimumPoolStake', + type: 'uint256', + }, + { + name: '_cobbDouglasAlphaNumerator', + type: 'uint32', + }, + { + name: '_cobbDouglasAlphaDenominator', + type: 'uint32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'staker', + type: 'address', + }, + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'getStakeDelegatedToPoolByOwner', + outputs: [ + { + name: 'balance', + type: 'tuple', + components: [ + { + name: 'currentEpoch', + type: 'uint64', + }, + { + name: 'currentEpochBalance', + type: 'uint96', + }, + { + name: 'nextEpochBalance', + type: 'uint96', + }, + ], + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'getStakingPool', + outputs: [ + { + name: '', + type: 'tuple', + components: [ + { + name: 'operator', + type: 'address', + }, + { + name: 'operatorShare', + type: 'uint32', + }, + ], + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'getStakingPoolStatsThisEpoch', + outputs: [ + { + name: '', + type: 'tuple', + components: [ + { + name: 'feesCollected', + type: 'uint256', + }, + { + name: 'weightedStake', + type: 'uint256', + }, + { + name: 'membersStake', + type: 'uint256', + }, + ], + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'staker', + type: 'address', + }, + ], + name: 'getTotalStake', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'getTotalStakeDelegatedToPool', + outputs: [ + { + name: 'balance', + type: 'tuple', + components: [ + { + name: 'currentEpoch', + type: 'uint64', + }, + { + name: 'currentEpochBalance', + type: 'uint96', + }, + { + name: 'nextEpochBalance', + type: 'uint96', + }, + ], + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getWethContract', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getZrxVault', + outputs: [ + { + name: 'zrxVault', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'init', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'joinStakingPoolAsMaker', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'lastPoolId', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'minimumPoolStake', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'from', + type: 'tuple', + components: [ + { + name: 'status', + type: 'uint8', + }, + { + name: 'poolId', + type: 'bytes32', + }, + ], + }, + { + name: 'to', + type: 'tuple', + components: [ + { + name: 'status', + type: 'uint8', + }, + { + name: 'poolId', + type: 'bytes32', + }, + ], + }, + { + name: 'amount', + type: 'uint256', + }, + ], + name: 'moveStake', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'owner', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'makerAddress', + type: 'address', + }, + { + name: 'payerAddress', + type: 'address', + }, + { + name: 'protocolFee', + type: 'uint256', + }, + ], + name: 'payProtocolFee', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'address', + }, + ], + name: 'poolIdByMaker', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'bytes32', + }, + { + name: 'index_1', + type: 'uint256', + }, + ], + name: 'poolStatsByEpoch', + outputs: [ + { + name: 'feesCollected', + type: 'uint256', + }, + { + name: 'weightedStake', + type: 'uint256', + }, + { + name: 'membersStake', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + ], + name: 'removeAuthorizedAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + { + name: 'index', + type: 'uint256', + }, + ], + name: 'removeAuthorizedAddressAtIndex', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'addr', + type: 'address', + }, + ], + name: 'removeExchangeAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardDelegatedStakeWeight', + outputs: [ + { + name: '', + type: 'uint32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'bytes32', + }, + ], + name: 'rewardsByPoolId', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_epochDurationInSeconds', + type: 'uint256', + }, + { + name: '_rewardDelegatedStakeWeight', + type: 'uint32', + }, + { + name: '_minimumPoolStake', + type: 'uint256', + }, + { + name: '_cobbDouglasAlphaNumerator', + type: 'uint32', + }, + { + name: '_cobbDouglasAlphaDenominator', + type: 'uint32', + }, + ], + name: 'setParams', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'wethAddress', + type: 'address', + }, + ], + name: 'setWethContract', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'zrxVaultAddress', + type: 'address', + }, + ], + name: 'setZrxVault', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'amount', + type: 'uint256', + }, + ], + name: 'stake', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'stakingContract', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'testWethAddress', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'testZrxVaultAddress', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'amount', + type: 'uint256', + }, + ], + name: 'unstake', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'address', + }, + ], + name: 'validExchanges', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'wethReservedForPoolRewards', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'poolId', + type: 'bytes32', + }, + ], + name: 'withdrawDelegatorRewards', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + ] as ContractAbi; + return abi; + } + /** + * Subscribe to an event type emitted by the TestStaking contract. + * @param eventName The TestStaking contract event you would like to subscribe to. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` + * @param callback Callback that gets called when a log is added/removed + * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) + * @return Subscription token used later to unsubscribe + */ + public subscribe( + eventName: TestStakingEvents, + indexFilterValues: IndexedFilterValues, + callback: EventCallback, + isVerbose: boolean = false, + blockPollingIntervalMs?: number, + ): string { + assert.doesBelongToStringEnum('eventName', eventName, TestStakingEvents); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); + assert.isFunction('callback', callback); + const subscriptionToken = this._subscriptionManager.subscribe( + this.address, + eventName, + indexFilterValues, + TestStakingContract.ABI(), + callback, + isVerbose, + blockPollingIntervalMs, + ); + return subscriptionToken; + } + /** + * Cancel a subscription + * @param subscriptionToken Subscription token returned by `subscribe()` + */ + public unsubscribe(subscriptionToken: string): void { + this._subscriptionManager.unsubscribe(subscriptionToken); + } + /** + * Cancels all existing subscriptions + */ + public unsubscribeAll(): void { + this._subscriptionManager.unsubscribeAll(); + } + /** + * Gets historical logs without creating a subscription + * @param eventName The TestStaking contract event you would like to subscribe to. + * @param blockRange Block range to get logs from. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` + * @return Array of logs that match the parameters + */ + public async getLogsAsync( + eventName: TestStakingEvents, + blockRange: BlockRange, + indexFilterValues: IndexedFilterValues, + ): Promise>> { + assert.doesBelongToStringEnum('eventName', eventName, TestStakingEvents); + assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); + const logs = await this._subscriptionManager.getLogsAsync( + this.address, + eventName, + blockRange, + indexFilterValues, + TestStakingContract.ABI(), + ); + return logs; + } + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + deployedBytecode: string | undefined = TestStakingContract.deployedBytecode, + ) { + super( + 'TestStaking', + TestStakingContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + deployedBytecode, + ); + classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); + this._subscriptionManager = new SubscriptionManager( + TestStakingContract.ABI(), + this._web3Wrapper, + ); + } +} + +// tslint:disable:max-file-line-count +// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align +// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts new file mode 100644 index 0000000000..7f364cf7c8 --- /dev/null +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts @@ -0,0 +1,2719 @@ +// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming +// tslint:disable:whitespace no-unbound-method no-trailing-whitespace +// tslint:disable:no-unused-variable +import { BaseContract, SubscriptionManager, PromiseWithTransactionHash } from '@0x/base-contract'; +import { schemas } from '@0x/json-schemas'; +import { + BlockParam, + BlockParamLiteral, + BlockRange, + CallData, + ContractAbi, + ContractArtifact, + DecodedLogArgs, + LogWithDecodedArgs, + MethodAbi, + TransactionReceiptWithDecodedLogs, + TxData, + TxDataPayable, + SupportedProvider, +} from 'ethereum-types'; +import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; +import { Web3Wrapper } from '@0x/web3-wrapper'; +import { assert } from '@0x/assert'; +import * as ethers from 'ethers'; +// tslint:enable:no-unused-variable + +export type ZrxVaultEventArgs = + | ZrxVaultAuthorizedAddressAddedEventArgs + | ZrxVaultAuthorizedAddressRemovedEventArgs + | ZrxVaultDepositEventArgs + | ZrxVaultInCatastrophicFailureModeEventArgs + | ZrxVaultOwnershipTransferredEventArgs + | ZrxVaultStakingProxySetEventArgs + | ZrxVaultWithdrawEventArgs + | ZrxVaultZrxProxySetEventArgs; + +export enum ZrxVaultEvents { + AuthorizedAddressAdded = 'AuthorizedAddressAdded', + AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', + Deposit = 'Deposit', + InCatastrophicFailureMode = 'InCatastrophicFailureMode', + OwnershipTransferred = 'OwnershipTransferred', + StakingProxySet = 'StakingProxySet', + Withdraw = 'Withdraw', + ZrxProxySet = 'ZrxProxySet', +} + +export interface ZrxVaultAuthorizedAddressAddedEventArgs extends DecodedLogArgs { + target: string; + caller: string; +} + +export interface ZrxVaultAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { + target: string; + caller: string; +} + +export interface ZrxVaultDepositEventArgs extends DecodedLogArgs { + staker: string; + amount: BigNumber; +} + +export interface ZrxVaultInCatastrophicFailureModeEventArgs extends DecodedLogArgs { + sender: string; +} + +export interface ZrxVaultOwnershipTransferredEventArgs extends DecodedLogArgs { + previousOwner: string; + newOwner: string; +} + +export interface ZrxVaultStakingProxySetEventArgs extends DecodedLogArgs { + stakingProxyAddress: string; +} + +export interface ZrxVaultWithdrawEventArgs extends DecodedLogArgs { + staker: string; + amount: BigNumber; +} + +export interface ZrxVaultZrxProxySetEventArgs extends DecodedLogArgs { + zrxProxyAddress: string; +} + +/* istanbul ignore next */ +// tslint:disable:no-parameter-reassignment +// tslint:disable-next-line:class-name +export class ZrxVaultContract extends BaseContract { + /** + * @ignore + */ + public static deployedBytecode: string | undefined; + public addAuthorizedAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('target', target); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string): string { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public authorities = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isBigNumber('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public authorized = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('index_0', index_0); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public balanceOf = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('staker', staker); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [staker.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public balanceOfZrxVault = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('balanceOfZrxVault()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('balanceOfZrxVault()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public depositFrom = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + staker: string, + amount: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('depositFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.depositFrom.callAsync(staker, amount, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + staker: string, + amount: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.depositFrom.sendTransactionAsync(staker.toLowerCase(), amount, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + staker: string, + amount: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('depositFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + amount: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('depositFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('depositFrom(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(staker: string, amount: BigNumber): string { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('depositFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('depositFrom(address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + public enterCatastrophicFailure = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('enterCatastrophicFailure()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.enterCatastrophicFailure.callAsync(txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.enterCatastrophicFailure.sendTransactionAsync(txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('enterCatastrophicFailure()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('enterCatastrophicFailure()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('enterCatastrophicFailure()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('enterCatastrophicFailure()', []); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('enterCatastrophicFailure()'); + return abiEncoder.getSelector(); + }, + }; + public getAuthorizedAddresses = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public isInCatastrophicFailure = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('isInCatastrophicFailure()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('isInCatastrophicFailure()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public owner = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('owner()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('owner()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public removeAuthorizedAddress = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('target', target); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string): string { + assert.isString('target', target); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, + }; + public removeAuthorizedAddressAtIndex = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + target: string, + index: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + target: string, + index: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + target: string, + index: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + target: string, + index: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('target', target); + assert.isBigNumber('index', index); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(target: string, index: BigNumber): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + public setStakingProxy = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + _stakingProxyAddress: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('_stakingProxyAddress', _stakingProxyAddress); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('setStakingProxy(address)', [ + _stakingProxyAddress.toLowerCase(), + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.setStakingProxy.callAsync(_stakingProxyAddress, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + _stakingProxyAddress: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('_stakingProxyAddress', _stakingProxyAddress); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.setStakingProxy.sendTransactionAsync( + _stakingProxyAddress.toLowerCase(), + txData, + opts, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(_stakingProxyAddress: string, txData?: Partial | undefined): Promise { + assert.isString('_stakingProxyAddress', _stakingProxyAddress); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('setStakingProxy(address)', [ + _stakingProxyAddress.toLowerCase(), + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + _stakingProxyAddress: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('_stakingProxyAddress', _stakingProxyAddress); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('setStakingProxy(address)', [ + _stakingProxyAddress.toLowerCase(), + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('setStakingProxy(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(_stakingProxyAddress: string): string { + assert.isString('_stakingProxyAddress', _stakingProxyAddress); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setStakingProxy(address)', [ + _stakingProxyAddress.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('setStakingProxy(address)'); + return abiEncoder.getSelector(); + }, + }; + public setZrxProxy = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + _zrxProxyAddress: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('_zrxProxyAddress', _zrxProxyAddress); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('setZrxProxy(address)', [_zrxProxyAddress.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.setZrxProxy.callAsync(_zrxProxyAddress, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + _zrxProxyAddress: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('_zrxProxyAddress', _zrxProxyAddress); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.setZrxProxy.sendTransactionAsync(_zrxProxyAddress.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(_zrxProxyAddress: string, txData?: Partial | undefined): Promise { + assert.isString('_zrxProxyAddress', _zrxProxyAddress); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('setZrxProxy(address)', [_zrxProxyAddress.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + _zrxProxyAddress: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('_zrxProxyAddress', _zrxProxyAddress); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('setZrxProxy(address)', [_zrxProxyAddress.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('setZrxProxy(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(_zrxProxyAddress: string): string { + assert.isString('_zrxProxyAddress', _zrxProxyAddress); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setZrxProxy(address)', [ + _zrxProxyAddress.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('setZrxProxy(address)'); + return abiEncoder.getSelector(); + }, + }; + public stakingProxyAddress = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('stakingProxyAddress()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('stakingProxyAddress()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + public transferOwnership = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + newOwner: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('newOwner', newOwner); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.isString('newOwner', newOwner); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(newOwner: string): string { + assert.isString('newOwner', newOwner); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, + }; + public withdrawAllFrom = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + staker: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('staker', staker); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('withdrawAllFrom(address)', [staker.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.withdrawAllFrom.callAsync(staker, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + staker: string, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('staker', staker); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.withdrawAllFrom.sendTransactionAsync(staker.toLowerCase(), txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync(staker: string, txData?: Partial | undefined): Promise { + assert.isString('staker', staker); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('withdrawAllFrom(address)', [staker.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('staker', staker); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('withdrawAllFrom(address)', [staker.toLowerCase()]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('withdrawAllFrom(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(staker: string): string { + assert.isString('staker', staker); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAllFrom(address)', [ + staker.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('withdrawAllFrom(address)'); + return abiEncoder.getSelector(); + }, + }; + public withdrawFrom = { + /** + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async sendTransactionAsync( + staker: string, + amount: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + if (opts.shouldValidate !== false) { + await self.withdrawFrom.callAsync(staker, amount, txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + /** + * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. + * If the transaction was mined, but reverted, an error is thrown. + * @param txData Additional data for transaction + * @param pollingIntervalMs Interval at which to poll for success + * @returns A promise that resolves when the transaction is successful + */ + awaitTransactionSuccessAsync( + staker: string, + amount: BigNumber, + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const txHashPromise = self.withdrawFrom.sendTransactionAsync(staker.toLowerCase(), amount, txData, opts); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + opts.pollingIntervalMs, + opts.timeoutMs, + ); + })(), + ); + }, + /** + * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. + * @param txData Additional data for transaction + * @returns The hash of the transaction + */ + async estimateGasAsync( + staker: string, + amount: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync( + staker: string, + amount: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('withdrawFrom(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @returns The ABI encoded transaction data as a string + */ + getABIEncodedTransactionData(staker: string, amount: BigNumber): string { + assert.isString('staker', staker); + assert.isBigNumber('amount', amount); + const self = (this as any) as ZrxVaultContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ + staker.toLowerCase(), + amount, + ]); + return abiEncodedTransactionData; + }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZrxVaultContract; + const abiEncoder = self._lookupAbiEncoder('withdrawFrom(address,uint256)'); + return abiEncoder.getSelector(); + }, + }; + public zrxAssetProxy = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as ZrxVaultContract; + const encodedData = self._strictEncodeArguments('zrxAssetProxy()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('zrxAssetProxy()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + }; + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( + artifact: ContractArtifact | SimpleContractArtifact, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _zrxProxyAddress: string, + _zrxTokenAddress: string, + ): Promise { + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (artifact.compilerOutput === undefined) { + throw new Error('Compiler output not found in the artifact file'); + } + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const bytecode = artifact.compilerOutput.evm.bytecode.object; + const abi = artifact.compilerOutput.abi; + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + if (Object.keys(logDecodeDependencies) !== undefined) { + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } + } + return ZrxVaultContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _zrxProxyAddress, + _zrxTokenAddress, + ); + } + public static async deployAsync( + bytecode: string, + abi: ContractAbi, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractAbi }, + _zrxProxyAddress: string, + _zrxTokenAddress: string, + ): Promise { + assert.isHexString('bytecode', bytecode); + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const constructorAbi = BaseContract._lookupConstructorAbi(abi); + [_zrxProxyAddress, _zrxTokenAddress] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [_zrxProxyAddress, _zrxTokenAddress], + BaseContract._bigNumberToString, + ); + const iface = new ethers.utils.Interface(abi); + const deployInfo = iface.deployFunction; + const txData = deployInfo.encode(bytecode, [_zrxProxyAddress, _zrxTokenAddress]); + const web3Wrapper = new Web3Wrapper(provider); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { data: txData }, + txDefaults, + web3Wrapper.estimateGasAsync.bind(web3Wrapper), + ); + const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); + logUtils.log(`transactionHash: ${txHash}`); + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); + logUtils.log(`ZrxVault successfully deployed at ${txReceipt.contractAddress}`); + const contractInstance = new ZrxVaultContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_zrxProxyAddress, _zrxTokenAddress]; + return contractInstance; + } + + /** + * @returns The contract ABI + */ + public static ABI(): ContractAbi { + const abi = [ + { + inputs: [ + { + name: '_zrxProxyAddress', + type: 'address', + }, + { + name: '_zrxTokenAddress', + type: 'address', + }, + ], + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + name: 'target', + type: 'address', + indexed: true, + }, + { + name: 'caller', + type: 'address', + indexed: true, + }, + ], + name: 'AuthorizedAddressAdded', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'target', + type: 'address', + indexed: true, + }, + { + name: 'caller', + type: 'address', + indexed: true, + }, + ], + name: 'AuthorizedAddressRemoved', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'staker', + type: 'address', + indexed: true, + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + }, + ], + name: 'Deposit', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'sender', + type: 'address', + indexed: false, + }, + ], + name: 'InCatastrophicFailureMode', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'previousOwner', + type: 'address', + indexed: true, + }, + { + name: 'newOwner', + type: 'address', + indexed: true, + }, + ], + name: 'OwnershipTransferred', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'stakingProxyAddress', + type: 'address', + indexed: false, + }, + ], + name: 'StakingProxySet', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'staker', + type: 'address', + indexed: true, + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + }, + ], + name: 'Withdraw', + outputs: [], + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + name: 'zrxProxyAddress', + type: 'address', + indexed: false, + }, + ], + name: 'ZrxProxySet', + outputs: [], + type: 'event', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + ], + name: 'addAuthorizedAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'uint256', + }, + ], + name: 'authorities', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'index_0', + type: 'address', + }, + ], + name: 'authorized', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'staker', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'balanceOfZrxVault', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'staker', + type: 'address', + }, + { + name: 'amount', + type: 'uint256', + }, + ], + name: 'depositFrom', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'enterCatastrophicFailure', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getAuthorizedAddresses', + outputs: [ + { + name: '', + type: 'address[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'isInCatastrophicFailure', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'owner', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + ], + name: 'removeAuthorizedAddress', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'target', + type: 'address', + }, + { + name: 'index', + type: 'uint256', + }, + ], + name: 'removeAuthorizedAddressAtIndex', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_stakingProxyAddress', + type: 'address', + }, + ], + name: 'setStakingProxy', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_zrxProxyAddress', + type: 'address', + }, + ], + name: 'setZrxProxy', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'stakingProxyAddress', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'staker', + type: 'address', + }, + ], + name: 'withdrawAllFrom', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'staker', + type: 'address', + }, + { + name: 'amount', + type: 'uint256', + }, + ], + name: 'withdrawFrom', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'zrxAssetProxy', + outputs: [ + { + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + ] as ContractAbi; + return abi; + } + /** + * Subscribe to an event type emitted by the ZrxVault contract. + * @param eventName The ZrxVault contract event you would like to subscribe to. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` + * @param callback Callback that gets called when a log is added/removed + * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) + * @return Subscription token used later to unsubscribe + */ + public subscribe( + eventName: ZrxVaultEvents, + indexFilterValues: IndexedFilterValues, + callback: EventCallback, + isVerbose: boolean = false, + blockPollingIntervalMs?: number, + ): string { + assert.doesBelongToStringEnum('eventName', eventName, ZrxVaultEvents); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); + assert.isFunction('callback', callback); + const subscriptionToken = this._subscriptionManager.subscribe( + this.address, + eventName, + indexFilterValues, + ZrxVaultContract.ABI(), + callback, + isVerbose, + blockPollingIntervalMs, + ); + return subscriptionToken; + } + /** + * Cancel a subscription + * @param subscriptionToken Subscription token returned by `subscribe()` + */ + public unsubscribe(subscriptionToken: string): void { + this._subscriptionManager.unsubscribe(subscriptionToken); + } + /** + * Cancels all existing subscriptions + */ + public unsubscribeAll(): void { + this._subscriptionManager.unsubscribeAll(); + } + /** + * Gets historical logs without creating a subscription + * @param eventName The ZrxVault contract event you would like to subscribe to. + * @param blockRange Block range to get logs from. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` + * @return Array of logs that match the parameters + */ + public async getLogsAsync( + eventName: ZrxVaultEvents, + blockRange: BlockRange, + indexFilterValues: IndexedFilterValues, + ): Promise>> { + assert.doesBelongToStringEnum('eventName', eventName, ZrxVaultEvents); + assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); + const logs = await this._subscriptionManager.getLogsAsync( + this.address, + eventName, + blockRange, + indexFilterValues, + ZrxVaultContract.ABI(), + ); + return logs; + } + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + deployedBytecode: string | undefined = ZrxVaultContract.deployedBytecode, + ) { + super( + 'ZrxVault', + ZrxVaultContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + deployedBytecode, + ); + classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); + this._subscriptionManager = new SubscriptionManager( + ZrxVaultContract.ABI(), + this._web3Wrapper, + ); + } +} + +// tslint:disable:max-file-line-count +// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align +// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts index be9d79a8bd..dd7e6dc95d 100644 --- a/packages/abi-gen-wrappers/src/index.ts +++ b/packages/abi-gen-wrappers/src/index.ts @@ -100,6 +100,30 @@ export { CoordinatorRegistryCoordinatorEndpointSetEventArgs, CoordinatorRegistryContract, } from './generated-wrappers/coordinator_registry'; +export { + ZrxVaultAuthorizedAddressAddedEventArgs, + ZrxVaultAuthorizedAddressRemovedEventArgs, + ZrxVaultContract, + ZrxVaultDepositEventArgs, + ZrxVaultEventArgs, + ZrxVaultEvents, + ZrxVaultInCatastrophicFailureModeEventArgs, + ZrxVaultOwnershipTransferredEventArgs, + ZrxVaultStakingProxySetEventArgs, + ZrxVaultWithdrawEventArgs, + ZrxVaultZrxProxySetEventArgs, +} from './generated-wrappers/zrx_vault'; + +export { + ERC20BridgeProxyAuthorizedAddressAddedEventArgs, + ERC20BridgeProxyAuthorizedAddressRemovedEventArgs, + ERC20BridgeProxyContract, + ERC20BridgeProxyEventArgs, + ERC20BridgeProxyEvents, +} from './generated-wrappers/erc20_bridge_proxy'; + +// Note: No need to export other events as this is a StakingContract with more open constructor args +export { TestStakingContract } from './generated-wrappers/test_staking'; export * from '@0x/contract-addresses'; export { diff --git a/packages/contract-addresses/addresses.json b/packages/contract-addresses/addresses.json index acd265f741..c283d0d5ab 100644 --- a/packages/contract-addresses/addresses.json +++ b/packages/contract-addresses/addresses.json @@ -101,17 +101,17 @@ "exchange": "0x48bacb9266a570d521063ef5dd96e61686dbe788", "zeroExGovernor": "0x0000000000000000000000000000000000000000", "assetProxyOwner": "0x0000000000000000000000000000000000000000", - "forwarder": "0x0000000000000000000000000000000000000000", + "forwarder": "0xaa86dda78e9434aca114b6676fc742a18d15a1cc", "orderValidator": "0x0000000000000000000000000000000000000000", "dutchAuction": "0x0000000000000000000000000000000000000000", "coordinatorRegistry": "0x1941ff73d1154774d87521d2d0aaad5d19c8df60", - "coordinator": "0x0000000000000000000000000000000000000000", + "coordinator": "0x0d8b0dd11f5d34ed41d556def5f841900d5b1c6b", "multiAssetProxy": "0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db", "staticCallProxy": "0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f", "devUtils": "0x38ef19fdf8e8415f18c307ed71967e19aac28ba1", - "zrxVault": "0x0000000000000000000000000000000000000000", - "staking": "0x0000000000000000000000000000000000000000", - "stakingProxy": "0x0000000000000000000000000000000000000000", - "erc20BridgeProxy": "0x0000000000000000000000000000000000000000" + "zrxVault": "0x609acc8b356894a937fc58f3411f9528de96ecb1", + "staking": "0xca9717a4a6e8009b3518648c9f3e7676255471a1", + "stakingProxy": "0x4586649629f699f9a4b61d0e962dc3c9025fe488", + "erc20BridgeProxy": "0xf23276778860e420acfc18ebeebf7e829b06965c" } } diff --git a/packages/contract-artifacts/artifacts/ERC20BridgeProxy.json b/packages/contract-artifacts/artifacts/ERC20BridgeProxy.json new file mode 100644 index 0000000000..41543a9a59 --- /dev/null +++ b/packages/contract-artifacts/artifacts/ERC20BridgeProxy.json @@ -0,0 +1,218 @@ +{ + "schemaVersion": "2.0.0", + "contractName": "ERC20BridgeProxy", + "compilerOutput": { + "abi": [ + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "AuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "AuthorizedAddressRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "authorities", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "authorized", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "bytes", "name": "assetData", "type": "bytes" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "balance", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getProxyId", + "outputs": [{ "internalType": "bytes4", "name": "proxyId", "type": "bytes4" }], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "target", "type": "address" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "removeAuthorizedAddressAtIndex", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "bytes", "name": "assetData", "type": "bytes" }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "devdoc": { + "methods": { + "addAuthorizedAddress(address)": { + "details": "Authorizes an address.", + "params": { "target": "Address to authorize." } + }, + "balanceOf(bytes,address)": { + "details": "Retrieves the balance of `owner` for this asset.", + "return": "balance The balance of the ERC20 token being transferred by this asset proxy." + }, + "getAuthorizedAddresses()": { + "details": "Gets all authorized addresses.", + "return": "Array of authorized addresses." + }, + "getProxyId()": { + "details": "Gets the proxy id associated with this asset proxy.", + "return": "proxyId The proxy id." + }, + "removeAuthorizedAddress(address)": { + "details": "Removes authorizion of an address.", + "params": { "target": "Address to remove authorization from." } + }, + "removeAuthorizedAddressAtIndex(address,uint256)": { + "details": "Removes authorizion of an address.", + "params": { + "index": "Index of target in authorities array.", + "target": "Address to remove authorization from." + } + }, + "transferFrom(bytes,address,address,uint256)": { + "details": "Calls a bridge contract to transfer `amount` of ERC20 from `from` to `to`. Asserts that the balance of `to` has increased by `amount`.", + "params": { + "amount": "Amount of asset to transfer.", + "assetData": "Abi-encoded data for this asset proxy encoded as: abi.encodeWithSelector( bytes4 PROXY_ID, address tokenAddress, address bridgeAddress, bytes bridgeData )", + "from": "Address to transfer asset from.", + "to": "Address to transfer asset to." + } + } + } + }, + "evm": { + "bytecode": { + "object": "0x6080604052600080546001600160a01b03191633179055611463806100256000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a85e59e411610081578063d39de6e91161005b578063d39de6e914610182578063f2fde38b14610197578063fc124ebd146101aa576100c9565b8063a85e59e41461013a578063ae25532e1461014d578063b918161114610162576100c9565b806370712939116100b2578063707129391461010c5780638da5cb5b1461011f5780639ad2674414610127576100c9565b806342f1181e146100ce578063494503d4146100e3575b600080fd5b6100e16100dc366004610f27565b6101ca565b005b6100f66100f1366004611160565b6101de565b6040516101039190611190565b60405180910390f35b6100e161011a366004610f27565b610212565b6100f66102cc565b6100e1610135366004611032565b6102e8565b6100e16101483660046110f2565b6102fa565b6101556104f6565b60405161010391906112c5565b610175610170366004610f27565b61051b565b60405161010391906112ba565b61018a610530565b6040516101039190611261565b6100e16101a5366004610f27565b61059f565b6101bd6101b836600461109d565b610642565b6040516101039190611390565b6101d26106bc565b6101db81610705565b50565b600281815481106101eb57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61021a6106bc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166102585761025861025382610836565b6108d5565b60005b6002548110156102c8578173ffffffffffffffffffffffffffffffffffffffff166002828154811061028957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156102c0576102bb82826108dd565b6102c8565b60010161025b565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6102f06106bc565b6102c882826108dd565b610302610b2c565b60008060606103566004898990508a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516103699190810190610f5f565b925092509250600061037b8487610b8d565b905060008373ffffffffffffffffffffffffffffffffffffffff1663c2df82e6868a8a8a886040518663ffffffff1660e01b81526004016103c09594939291906111d8565b602060405180830381600087803b1580156103da57600080fd5b505af11580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610412919081019061105d565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167fdc1600f30000000000000000000000000000000000000000000000000000000014610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611322565b60405180910390fd5b6104a28588610b8d565b6104b2838863ffffffff610c3916565b11156104ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611359565b50505050505050505050565b7fdc1600f3000000000000000000000000000000000000000000000000000000005b90565b60016020526000908152604090205460ff1681565b6060600280548060200260200160405190810160405280929190818152602001828054801561059557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161056a575b5050505050905090565b6105a76106bc565b73ffffffffffffffffffffffffffffffffffffffff81166105d2576105cd610253610c55565b6101db565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60008061069460048686905087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516106a79190810190610f43565b90506106b38184610b8d565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610703576000546107039061025390339073ffffffffffffffffffffffffffffffffffffffff16610c8c565b565b73ffffffffffffffffffffffffffffffffffffffff811661072b5761072b610253610d2e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156107655761076561025382610d65565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b606063eb5108a260e01b826040516024016108519190611190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff166109165761091661025383610836565b60025481106109315761093161025382600280549050610d80565b8173ffffffffffffffffffffffffffffffffffffffff166002828154811061095557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16146109b7576109b76102536002838154811061098f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684610d9d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610a3257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610a6557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610ae49082610e99565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b3360009081526001602052604090205460ff166107035761070361025333610dba565b606081831115610b6857610b6861025360008585610dd5565b8351821115610b8157610b816102536001848751610dd5565b50819003910190815290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610be2908590600401611190565b60206040518083038186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c329190810190611178565b9392505050565b600082820183811015610c3257610c3261025360008686610e7a565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b6060631de45ad160e01b8383604051602401610ca99291906111b1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b826040516024016108519190611190565b606063e9f8377160e01b8383604051602401610ca9929190611399565b606063140a84db60e01b8383604051602401610ca99291906111b1565b606063b65a25b960e01b826040516024016108519190611190565b6060632800659560e01b848484604051602401610df493929190611314565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063e946c1bb60e01b848484604051602401610df4939291906112f2565b815481835581811115610ebd57600083815260209020610ebd918101908301610ec2565b505050565b61051891905b80821115610edc5760008155600101610ec8565b5090565b60008083601f840112610ef1578182fd5b50813567ffffffffffffffff811115610f08578182fd5b602083019150836020828501011115610f2057600080fd5b9250929050565b600060208284031215610f38578081fd5b8135610c32816113fe565b600060208284031215610f54578081fd5b8151610c32816113fe565b600080600060608486031215610f73578182fd5b8351610f7e816113fe565b6020850151909350610f8f816113fe565b604085015190925067ffffffffffffffff80821115610fac578283fd5b81860187601f820112610fbd578384fd5b8051925081831115610fcd578384fd5b610ffe60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116016113a7565b9150828252876020848301011115611014578384fd5b6110258360208401602084016113ce565b5080925050509250925092565b60008060408385031215611044578182fd5b823561104f816113fe565b946020939093013593505050565b60006020828403121561106e578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c32578182fd5b6000806000604084860312156110b1578283fd5b833567ffffffffffffffff8111156110c7578384fd5b6110d386828701610ee0565b90945092505060208401356110e7816113fe565b809150509250925092565b600080600080600060808688031215611109578081fd5b853567ffffffffffffffff81111561111f578182fd5b61112b88828901610ee0565b909650945050602086013561113f816113fe565b9250604086013561114f816113fe565b949793965091946060013592915050565b600060208284031215611171578081fd5b5035919050565b600060208284031215611189578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015280861660408401525083606083015260a0608083015282518060a084015261122b8160c08501602087016113ce565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160c0019695505050505050565b602080825282518282018190526000918401906040840190835b818110156112af57835173ffffffffffffffffffffffffffffffffffffffff1683526020938401939092019160010161127b565b509095945050505050565b901515815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b606081016004851061130057fe5b938152602081019290925260409091015290565b606081016008851061130057fe5b6020808252600d908201527f4252494447455f4641494c454400000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f4252494447455f554e4445525041590000000000000000000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156113c657600080fd5b604052919050565b60005b838110156113e95781810151838201526020016113d1565b838111156113f8576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff811681146101db57600080fdfea365627a7a723158208443fe55d18b7dc9cff24ff524db866409ee96cb967c5e055d122b01700b898d6c6578706572696d656e74616cf564736f6c634300050c0040" + }, + "deployedBytecode": { + "object": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a85e59e411610081578063d39de6e91161005b578063d39de6e914610182578063f2fde38b14610197578063fc124ebd146101aa576100c9565b8063a85e59e41461013a578063ae25532e1461014d578063b918161114610162576100c9565b806370712939116100b2578063707129391461010c5780638da5cb5b1461011f5780639ad2674414610127576100c9565b806342f1181e146100ce578063494503d4146100e3575b600080fd5b6100e16100dc366004610f27565b6101ca565b005b6100f66100f1366004611160565b6101de565b6040516101039190611190565b60405180910390f35b6100e161011a366004610f27565b610212565b6100f66102cc565b6100e1610135366004611032565b6102e8565b6100e16101483660046110f2565b6102fa565b6101556104f6565b60405161010391906112c5565b610175610170366004610f27565b61051b565b60405161010391906112ba565b61018a610530565b6040516101039190611261565b6100e16101a5366004610f27565b61059f565b6101bd6101b836600461109d565b610642565b6040516101039190611390565b6101d26106bc565b6101db81610705565b50565b600281815481106101eb57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61021a6106bc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166102585761025861025382610836565b6108d5565b60005b6002548110156102c8578173ffffffffffffffffffffffffffffffffffffffff166002828154811061028957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156102c0576102bb82826108dd565b6102c8565b60010161025b565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6102f06106bc565b6102c882826108dd565b610302610b2c565b60008060606103566004898990508a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516103699190810190610f5f565b925092509250600061037b8487610b8d565b905060008373ffffffffffffffffffffffffffffffffffffffff1663c2df82e6868a8a8a886040518663ffffffff1660e01b81526004016103c09594939291906111d8565b602060405180830381600087803b1580156103da57600080fd5b505af11580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610412919081019061105d565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167fdc1600f30000000000000000000000000000000000000000000000000000000014610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611322565b60405180910390fd5b6104a28588610b8d565b6104b2838863ffffffff610c3916565b11156104ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611359565b50505050505050505050565b7fdc1600f3000000000000000000000000000000000000000000000000000000005b90565b60016020526000908152604090205460ff1681565b6060600280548060200260200160405190810160405280929190818152602001828054801561059557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161056a575b5050505050905090565b6105a76106bc565b73ffffffffffffffffffffffffffffffffffffffff81166105d2576105cd610253610c55565b6101db565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60008061069460048686905087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516106a79190810190610f43565b90506106b38184610b8d565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610703576000546107039061025390339073ffffffffffffffffffffffffffffffffffffffff16610c8c565b565b73ffffffffffffffffffffffffffffffffffffffff811661072b5761072b610253610d2e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156107655761076561025382610d65565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b606063eb5108a260e01b826040516024016108519190611190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff166109165761091661025383610836565b60025481106109315761093161025382600280549050610d80565b8173ffffffffffffffffffffffffffffffffffffffff166002828154811061095557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16146109b7576109b76102536002838154811061098f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684610d9d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610a3257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610a6557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610ae49082610e99565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b3360009081526001602052604090205460ff166107035761070361025333610dba565b606081831115610b6857610b6861025360008585610dd5565b8351821115610b8157610b816102536001848751610dd5565b50819003910190815290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610be2908590600401611190565b60206040518083038186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c329190810190611178565b9392505050565b600082820183811015610c3257610c3261025360008686610e7a565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b6060631de45ad160e01b8383604051602401610ca99291906111b1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b826040516024016108519190611190565b606063e9f8377160e01b8383604051602401610ca9929190611399565b606063140a84db60e01b8383604051602401610ca99291906111b1565b606063b65a25b960e01b826040516024016108519190611190565b6060632800659560e01b848484604051602401610df493929190611314565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063e946c1bb60e01b848484604051602401610df4939291906112f2565b815481835581811115610ebd57600083815260209020610ebd918101908301610ec2565b505050565b61051891905b80821115610edc5760008155600101610ec8565b5090565b60008083601f840112610ef1578182fd5b50813567ffffffffffffffff811115610f08578182fd5b602083019150836020828501011115610f2057600080fd5b9250929050565b600060208284031215610f38578081fd5b8135610c32816113fe565b600060208284031215610f54578081fd5b8151610c32816113fe565b600080600060608486031215610f73578182fd5b8351610f7e816113fe565b6020850151909350610f8f816113fe565b604085015190925067ffffffffffffffff80821115610fac578283fd5b81860187601f820112610fbd578384fd5b8051925081831115610fcd578384fd5b610ffe60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116016113a7565b9150828252876020848301011115611014578384fd5b6110258360208401602084016113ce565b5080925050509250925092565b60008060408385031215611044578182fd5b823561104f816113fe565b946020939093013593505050565b60006020828403121561106e578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c32578182fd5b6000806000604084860312156110b1578283fd5b833567ffffffffffffffff8111156110c7578384fd5b6110d386828701610ee0565b90945092505060208401356110e7816113fe565b809150509250925092565b600080600080600060808688031215611109578081fd5b853567ffffffffffffffff81111561111f578182fd5b61112b88828901610ee0565b909650945050602086013561113f816113fe565b9250604086013561114f816113fe565b949793965091946060013592915050565b600060208284031215611171578081fd5b5035919050565b600060208284031215611189578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015280861660408401525083606083015260a0608083015282518060a084015261122b8160c08501602087016113ce565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160c0019695505050505050565b602080825282518282018190526000918401906040840190835b818110156112af57835173ffffffffffffffffffffffffffffffffffffffff1683526020938401939092019160010161127b565b509095945050505050565b901515815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b606081016004851061130057fe5b938152602081019290925260409091015290565b606081016008851061130057fe5b6020808252600d908201527f4252494447455f4641494c454400000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f4252494447455f554e4445525041590000000000000000000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156113c657600080fd5b604052919050565b60005b838110156113e95781810151838201526020016113d1565b838111156113f8576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff811681146101db57600080fdfea365627a7a723158208443fe55d18b7dc9cff24ff524db866409ee96cb967c5e055d122b01700b898d6c6578706572696d656e74616cf564736f6c634300050c0040" + } + } + }, + "compiler": { + "name": "solc", + "version": "soljson-v0.5.12+commit.7709ece9.js", + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000, + "details": { "yul": true, "deduplicate": true, "cse": true, "constantOptimizer": true } + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "devdoc", + "evm.bytecode.object", + "evm.bytecode.sourceMap", + "evm.deployedBytecode.object", + "evm.deployedBytecode.sourceMap" + ] + } + }, + "evmVersion": "constantinople" + } + }, + "chains": {} +} diff --git a/packages/contract-artifacts/artifacts/TestStaking.json b/packages/contract-artifacts/artifacts/TestStaking.json new file mode 100644 index 0000000000..b093b8f3d0 --- /dev/null +++ b/packages/contract-artifacts/artifacts/TestStaking.json @@ -0,0 +1,844 @@ +{ + "schemaVersion": "2.0.0", + "contractName": "TestStaking", + "compilerOutput": { + "abi": [ + { + "inputs": [ + { "internalType": "address", "name": "wethAddress", "type": "address" }, + { "internalType": "address", "name": "zrxVaultAddress", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "AuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "AuthorizedAddressRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "numPoolsToFinalize", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "rewardsAvailable", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalFeesCollected", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalWeightedStake", "type": "uint256" } + ], + "name": "EpochEnded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "rewardsPaid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "rewardsRemaining", "type": "uint256" } + ], + "name": "EpochFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "exchangeAddress", "type": "address" } + ], + "name": "ExchangeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "exchangeAddress", "type": "address" } + ], + "name": "ExchangeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "makerAddress", "type": "address" }, + { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "name": "MakerStakingPoolSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": false, "internalType": "uint8", "name": "fromStatus", "type": "uint8" }, + { "indexed": true, "internalType": "bytes32", "name": "fromPool", "type": "bytes32" }, + { "indexed": false, "internalType": "uint8", "name": "toStatus", "type": "uint8" }, + { "indexed": true, "internalType": "bytes32", "name": "toPool", "type": "bytes32" } + ], + "name": "MoveStake", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "indexed": false, "internalType": "uint32", "name": "oldOperatorShare", "type": "uint32" }, + { "indexed": false, "internalType": "uint32", "name": "newOperatorShare", "type": "uint32" } + ], + "name": "OperatorShareDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "epochDurationInSeconds", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "rewardDelegatedStakeWeight", + "type": "uint32" + }, + { "indexed": false, "internalType": "uint256", "name": "minimumPoolStake", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "cobbDouglasAlphaNumerator", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cobbDouglasAlphaDenominator", + "type": "uint256" + } + ], + "name": "ParamsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, + { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "operatorReward", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "membersReward", "type": "uint256" } + ], + "name": "RewardsPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Stake", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "indexed": false, "internalType": "address", "name": "operator", "type": "address" }, + { "indexed": false, "internalType": "uint32", "name": "operatorShare", "type": "uint32" } + ], + "name": "StakingPoolCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, + { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "name": "StakingPoolEarnedRewardsInEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Unstake", + "type": "event" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "addr", "type": "address" }], + "name": "addExchangeAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "aggregatedStatsByEpoch", + "outputs": [ + { "internalType": "uint256", "name": "rewardsAvailable", "type": "uint256" }, + { "internalType": "uint256", "name": "numPoolsToFinalize", "type": "uint256" }, + { "internalType": "uint256", "name": "totalFeesCollected", "type": "uint256" }, + { "internalType": "uint256", "name": "totalWeightedStake", "type": "uint256" }, + { "internalType": "uint256", "name": "totalRewardsFinalized", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "authorities", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "authorized", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "cobbDouglasAlphaDenominator", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "cobbDouglasAlphaNumerator", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "member", "type": "address" } + ], + "name": "computeRewardBalanceOfDelegator", + "outputs": [{ "internalType": "uint256", "name": "reward", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "computeRewardBalanceOfOperator", + "outputs": [{ "internalType": "uint256", "name": "reward", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint32", "name": "operatorShare", "type": "uint32" }, + { "internalType": "bool", "name": "addOperatorAsMaker", "type": "bool" } + ], + "name": "createStakingPool", + "outputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "currentEpoch", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "currentEpochStartTimeInSeconds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "uint32", "name": "newOperatorShare", "type": "uint32" } + ], + "name": "decreaseStakingPoolOperatorShare", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "endEpoch", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "epochDurationInSeconds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "finalizePool", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCurrentEpochEarliestEndTimeInSeconds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "enum IStructs.StakeStatus", "name": "stakeStatus", "type": "uint8" }], + "name": "getGlobalStakeByStatus", + "outputs": [ + { + "components": [ + { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, + { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, + { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } + ], + "internalType": "struct IStructs.StoredBalance", + "name": "balance", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "staker", "type": "address" }, + { "internalType": "enum IStructs.StakeStatus", "name": "stakeStatus", "type": "uint8" } + ], + "name": "getOwnerStakeByStatus", + "outputs": [ + { + "components": [ + { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, + { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, + { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } + ], + "internalType": "struct IStructs.StoredBalance", + "name": "balance", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getParams", + "outputs": [ + { "internalType": "uint256", "name": "_epochDurationInSeconds", "type": "uint256" }, + { "internalType": "uint32", "name": "_rewardDelegatedStakeWeight", "type": "uint32" }, + { "internalType": "uint256", "name": "_minimumPoolStake", "type": "uint256" }, + { "internalType": "uint32", "name": "_cobbDouglasAlphaNumerator", "type": "uint32" }, + { "internalType": "uint32", "name": "_cobbDouglasAlphaDenominator", "type": "uint32" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "staker", "type": "address" }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "name": "getStakeDelegatedToPoolByOwner", + "outputs": [ + { + "components": [ + { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, + { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, + { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } + ], + "internalType": "struct IStructs.StoredBalance", + "name": "balance", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "getStakingPool", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "operator", "type": "address" }, + { "internalType": "uint32", "name": "operatorShare", "type": "uint32" } + ], + "internalType": "struct IStructs.Pool", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "getStakingPoolStatsThisEpoch", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "feesCollected", "type": "uint256" }, + { "internalType": "uint256", "name": "weightedStake", "type": "uint256" }, + { "internalType": "uint256", "name": "membersStake", "type": "uint256" } + ], + "internalType": "struct IStructs.PoolStats", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "staker", "type": "address" }], + "name": "getTotalStake", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "getTotalStakeDelegatedToPool", + "outputs": [ + { + "components": [ + { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, + { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, + { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } + ], + "internalType": "struct IStructs.StoredBalance", + "name": "balance", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getWethContract", + "outputs": [{ "internalType": "contract IEtherToken", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getZrxVault", + "outputs": [{ "internalType": "contract IZrxVault", "name": "zrxVault", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "init", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "joinStakingPoolAsMaker", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "lastPoolId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minimumPoolStake", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "components": [ + { "internalType": "enum IStructs.StakeStatus", "name": "status", "type": "uint8" }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "internalType": "struct IStructs.StakeInfo", + "name": "from", + "type": "tuple" + }, + { + "components": [ + { "internalType": "enum IStructs.StakeStatus", "name": "status", "type": "uint8" }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "internalType": "struct IStructs.StakeInfo", + "name": "to", + "type": "tuple" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "moveStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "makerAddress", "type": "address" }, + { "internalType": "address", "name": "payerAddress", "type": "address" }, + { "internalType": "uint256", "name": "protocolFee", "type": "uint256" } + ], + "name": "payProtocolFee", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "poolIdByMaker", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "bytes32", "name": "", "type": "bytes32" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "poolStatsByEpoch", + "outputs": [ + { "internalType": "uint256", "name": "feesCollected", "type": "uint256" }, + { "internalType": "uint256", "name": "weightedStake", "type": "uint256" }, + { "internalType": "uint256", "name": "membersStake", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "target", "type": "address" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "removeAuthorizedAddressAtIndex", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "addr", "type": "address" }], + "name": "removeExchangeAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rewardDelegatedStakeWeight", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "name": "rewardsByPoolId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint256", "name": "_epochDurationInSeconds", "type": "uint256" }, + { "internalType": "uint32", "name": "_rewardDelegatedStakeWeight", "type": "uint32" }, + { "internalType": "uint256", "name": "_minimumPoolStake", "type": "uint256" }, + { "internalType": "uint32", "name": "_cobbDouglasAlphaNumerator", "type": "uint32" }, + { "internalType": "uint32", "name": "_cobbDouglasAlphaDenominator", "type": "uint32" } + ], + "name": "setParams", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "wethAddress", "type": "address" }], + "name": "setWethContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "zrxVaultAddress", "type": "address" }], + "name": "setZrxVault", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "stake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stakingContract", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "testWethAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "testZrxVaultAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "unstake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "validExchanges", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "wethReservedForPoolRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], + "name": "withdrawDelegatorRewards", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "object": "0x60806040523480156200001157600080fd5b50604051620059be380380620059be833981016040819052620000349162000071565b600080546001600160a01b03199081163317909155601880546001600160a01b0394851690831617905560198054929093169116179055620000c8565b6000806040838503121562000084578182fd5b82516200009181620000af565b6020840151909250620000a481620000af565b809150509250929050565b6001600160a01b0381168114620000c557600080fd5b50565b6158e680620000d86000396000f3fe6080604052600436106103555760003560e01c80639051c3ee116101bb578063bb7ef7e0116100f7578063e8eeb3f811610095578063f18765321161006f578063f187653214610955578063f252b7a114610975578063f2fde38b14610995578063ff691b11146109b557610355565b8063e8eeb3f81461090b578063e907f00314610920578063ee99205c1461094057610355565b8063dcb31f76116100d1578063dcb31f76146108ac578063e0ee036e146108c1578063e1c7392a146108d6578063e804d0a4146108eb57610355565b8063bb7ef7e01461084a578063c18c91411461086a578063d39de6e91461088a57610355565b8063a694fc3a11610164578063b2baa33e1161013e578063b2baa33e146107d5578063b3e33379146107ea578063b510879f1461080a578063b91816111461082a57610355565b8063a694fc3a14610780578063abe0906a146107a0578063b0531524146107c057610355565b8063a26171e211610195578063a26171e214610743578063a3b4a32714610758578063a657e5791461076b57610355565b80639051c3ee146106ee5780639ad26744146107035780639c3ccc821461072357610355565b80634e67339f116102955780636340380111610233578063766718081161020d578063766718081461068257806381666796146106975780638a2e271a146106b95780638da5cb5b146106d957610355565b8063634038011461062d57806368a7d6cd14610642578063707129391461066257610355565b80635bd4ab731161026f5780635bd4ab73146105a55780635d91121d146105d25780635e615a6b146105f2578063624a72321461061857610355565b80634e67339f14610550578063587da0231461057057806358f6c7e31461058557610355565b80633c277fc51161030257806344a6958b116102dc57806344a6958b146104b657806346b97959146104d6578063494503d4146105035780634bcc3f671461052357610355565b80633c277fc5146104475780633e4ad7321461046957806342f1181e1461049657610355565b80632a94c279116103335780632a94c279146103c75780632e17de78146103f657806338229d931461041657610355565b806301e28d841461035a5780630b9663db1461037c5780631e7ff8f6146103a7575b600080fd5b34801561036657600080fd5b5061037a6103753660046151e2565b6109d5565b005b34801561038857600080fd5b50610391610aa3565b60405161039e9190615561565b60405180910390f35b3480156103b357600080fd5b506103916103c23660046151e2565b610bf0565b3480156103d357600080fd5b506103e76103e2366004615315565b610c8a565b60405161039e9392919061574e565b34801561040257600080fd5b5061037a6104113660046152d9565b610cb6565b34801561042257600080fd5b506104366104313660046152d9565b610e6b565b60405161039e95949392919061577f565b34801561045357600080fd5b5061045c610e9a565b60405161039e919061545e565b34801561047557600080fd5b506104896104843660046152d9565b610f43565b60405161039e919061570f565b3480156104a257600080fd5b5061037a6104b13660046151e2565b610f62565b3480156104c257600080fd5b506104896104d1366004615285565b610f76565b3480156104e257600080fd5b506104f66104f13660046152d9565b610fd5565b60405161039e91906156bb565b34801561050f57600080fd5b5061045c61051e3660046152d9565b611020565b34801561052f57600080fd5b5061054361053e3660046152d9565b611054565b60405161039e91906156dc565b34801561055c57600080fd5b5061037a61056b3660046151e2565b6110b6565b34801561057c57600080fd5b506103916110fd565b34801561059157600080fd5b5061037a6105a036600461537e565b611103565b3480156105b157600080fd5b506105c56105c03660046151e2565b611300565b60405161039e9190615556565b3480156105de57600080fd5b5061037a6105ed366004615336565b611315565b3480156105fe57600080fd5b506106076113de565b60405161039e9594939291906157a2565b34801561062457600080fd5b5061045c611407565b34801561063957600080fd5b50610391611472565b34801561064e57600080fd5b5061039161065d366004615431565b611478565b34801561066e57600080fd5b5061037a61067d3660046151e2565b6115b1565b34801561068e57600080fd5b50610391611666565b3480156106a357600080fd5b506106ac61166c565b60405161039e91906157e6565b3480156106c557600080fd5b5061037a6106d43660046151e2565b611678565b3480156106e557600080fd5b5061045c61173a565b3480156106fa57600080fd5b5061045c611756565b34801561070f57600080fd5b5061037a61071e36600461525a565b611772565b34801561072f57600080fd5b5061037a61073e3660046153d3565b611784565b34801561074f57600080fd5b506103916117fe565b61037a61076636600461521a565b611804565b34801561077757600080fd5b50610391611a54565b34801561078c57600080fd5b5061037a61079b3660046152d9565b611a5a565b3480156107ac57600080fd5b5061037a6107bb3660046151e2565b611b6f565b3480156107cc57600080fd5b50610391611bb6565b3480156107e157600080fd5b50610391611bbc565b3480156107f657600080fd5b5061037a6108053660046152d9565b611bda565b34801561081657600080fd5b5061037a6108253660046152d9565b611c1a565b34801561083657600080fd5b506105c56108453660046151e2565b611c24565b34801561085657600080fd5b506103916108653660046152d9565b611c39565b34801561087657600080fd5b506103916108853660046152d9565b611cc4565b34801561089657600080fd5b5061089f611cd6565b60405161039e91906154fd565b3480156108b857600080fd5b5061045c611d45565b3480156108cd57600080fd5b506106ac611d61565b3480156108e257600080fd5b5061037a611d6d565b3480156108f757600080fd5b50610489610906366004615362565b611d87565b34801561091757600080fd5b506106ac611ed7565b34801561092c57600080fd5b5061039161093b3660046152f1565b611eeb565b34801561094c57600080fd5b5061045c611f88565b34801561096157600080fd5b506103916109703660046151e2565b611fa4565b34801561098157600080fd5b5061048961099036600461525a565b611fb6565b3480156109a157600080fd5b5061037a6109b03660046151e2565b611ff7565b3480156109c157600080fd5b5061037a6109d03660046152d9565b61209a565b6109dd6122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16610a1d57610a1d610a186001836122ea565b61238c565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517ff50d0d312d501878616eb5e78ebf3ed6dcd3955aaef8165af9c6b057cc4832fb90610a9890839061545e565b60405180910390a150565b600c5460009081610abb82600163ffffffff61239416565b6000818152601660205260409020600101549091508015610ae357610ae3610a1883836123b3565b610aeb6123d0565b610af3612443565b600084815260166020526040902055610b0a6150ee565b50600083815260166020908152604091829020825160a08101845281548082526001830154938201849052600283015482860181905260038401546060840181905260049094015460808401529451919488947fbb4a26fa0ace13ee4da343896c20eaa44a618fb9071fdd8c2e2c960a4583189d94610b8c9491939291615764565b60405180910390a2610b9c6124e7565b6020810151610be357805160405185917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b291610bda916000916155ac565b60405180910390a25b6020015193505050505b90565b6000610bfa611407565b73ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401610c32919061545e565b60206040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c8291908101906153bb565b90505b919050565b601560209081526000928352604080842090915290825290208054600182015460029092015490919083565b33610cbf61511d565b73ffffffffffffffffffffffffffffffffffffffff821660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610d0c9061252a565b90506000610d3e82602001516bffffffffffffffffffffffff1683604001516bffffffffffffffffffffffff166125d0565b905080841115610d5557610d55610a1885836125e6565b73ffffffffffffffffffffffffffffffffffffffff831660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610da39085612603565b610dab611407565b73ffffffffffffffffffffffffffffffffffffffff16639470b0bd84866040518363ffffffff1660e01b8152600401610de59291906154d7565b600060405180830381600087803b158015610dff57600080fd5b505af1158015610e13573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd85604051610e5d9190615561565b60405180910390a250505050565b601660205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcb31f766040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f3d91908101906151fe565b91505090565b610f4b61511d565b6000828152600760205260409020610c829061252a565b610f6a61268a565b610f73816126d1565b50565b610f7e61511d565b610fcc60056000846001811115610f9157fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff88168252909252902061252a565b90505b92915050565b610fdd61513d565b506000908152601560209081526040808320600c548452825291829020825160608101845281548152600182015492810192909252600201549181019190915290565b6002818154811061102d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61105c61515e565b506000908152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff169082015290565b601980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5481565b338161110f57506112fb565b600061111e6020860186615362565b600181111561112957fe5b14801561114d575060006111406020850185615362565b600181111561114b57fe5b145b1561115857506112fb565b60016111676020860186615362565b600181111561117257fe5b14156111875761118784602001358284612802565b60016111966020850185615362565b60018111156111a157fe5b14156111b6576111b68360200135828461289b565b60006005816111c86020880188615362565b60018111156111d357fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff861682528352908120925090600590829061121d90880188615362565b600181111561122857fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff871682529092529020905061126b828286612934565b60208086013590870180359073ffffffffffffffffffffffffffffffffffffffff8616907f7d3ad1dcf03b9027064d1d9a474a69e0cecc31324c541d3eb9b5e6fa2f106c8d9088906112bd908c615362565b60018111156112c857fe5b6112d560208c018c615362565b60018111156112e057fe5b6040516112ef939291906157cd565b60405180910390a45050505b505050565b60106020526000908152604090205460ff1681565b8161131f81612a2d565b6000838152600a602052604090205474010000000000000000000000000000000000000000900463ffffffff16611357848285612a66565b6000848152600a60205260409081902080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8716021790555184907f8ea2a7a959bd25f226b7b0a4393613f7fdcaa8404e8bad96aa52dc1c1459016790610e5d90849087906157f7565b601154601254601354601454929363ffffffff9283169391928281169264010000000090041690565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639051c3ee6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b60115481565b600854600090339061149190600163ffffffff612aad16565b600881905591506114a682620f424086612a66565b6114ae61515e565b5060408051808201825273ffffffffffffffffffffffffffffffffffffffff838116825263ffffffff87811660208085019182526000888152600a9091528590208451815492517fffffffffffffffffffffffff00000000000000000000000000000000000000009093169416939093177fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000919092160217905590517fcec6fc86ea644053f6edff1160dfe3fa5c61e7a5ef9f873f145bb03a0bd319e7906115929085908590899061556a565b60405180910390a183156115a9576115a983611bda565b505092915050565b6115b961268a565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166115f2576115f2610a1882612ac9565b60005b600254811015611662578173ffffffffffffffffffffffffffffffffffffffff166002828154811061162357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561165a576116558282612b68565b611662565b6001016115f5565b5050565b600c5481565b60145463ffffffff1681565b6116806122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16156116bc576116bc610a186000836122ea565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f3e535d1ab441ef41c268fd9b52b478aee02d693c5ca2a84b5d26b89e0922e5e190610a9890839061545e565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60195473ffffffffffffffffffffffffffffffffffffffff1681565b61177a61268a565b6116628282612b68565b61178c6122c7565b6117998585858585612db7565b3073ffffffffffffffffffffffffffffffffffffffff1663c6f3a4276040518163ffffffff1660e01b815260040160006040518083038186803b1580156117df57600080fd5b505afa1580156117f3573d6000803e3d6000fd5b505050505050505050565b60135481565b3360009081526010602052604090205460ff1661182757611827610a1833612e7a565b61183081612e95565b3461190a5761183d610e9a565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd8330846040518463ffffffff1660e01b8152600401611879939291906154a6565b602060405180830381600087803b15801561189357600080fd5b505af11580156118a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118cb91908101906152bd565b61190a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190190615684565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152600960205260409020548061193b57506112fb565b600061194682610f43565b602001516bffffffffffffffffffffffff16905060135481101561196b5750506112fb565b600c54600083815260156020908152604080832084845282528083206016909252909120815480611a1a576000806119a38888612eb6565b6002870182905560018701819055600386015491935091506119cb908263ffffffff612aad16565b60038501556001808501546119e59163ffffffff612aad16565b6001850155604051889087907f14b098103235344975b17508c2391721cc9ac3f3fa2b56c7ff46f8480dfd074f90600090a350505b611a2a818863ffffffff612aad16565b83556002820154611a41908863ffffffff612aad16565b8260020181905550505050505050505050565b60085481565b33611a63611407565b73ffffffffffffffffffffffffffffffffffffffff166315cc36f282846040518363ffffffff1660e01b8152600401611a9d9291906154d7565b600060405180830381600087803b158015611ab757600080fd5b505af1158015611acb573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff811660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020611b1d9083612f42565b8073ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a83604051611b639190615561565b60405180910390a25050565b601880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60175481565b6000611bd5601154600d54612aad90919063ffffffff16565b905090565b3360008181526009602052604080822084905551839183917f5640833634fce74eb9211d1209a91dd5a1c8c6a751696bff9323b4db67f815139190a35050565b610f738133612fac565b60016020526000908152604090205460ff1681565b6000611c4361515e565b506000828152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611ca785613184565b91509150611cba83602001518383613241565b5095945050505050565b600b6020526000908152604090205481565b60606002805480602002602001604051908101604052809291908181526020018280548015611d3b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611d10575b5050505050905090565b60185473ffffffffffffffffffffffffffffffffffffffff1681565b60125463ffffffff1681565b611d756122c7565b611d7d613282565b611d85613295565b565b611d8f61511d565b60016000526004602052611dc27fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0561252a565b90506000826001811115611dd257fe5b1415610c85576000611de2611407565b73ffffffffffffffffffffffffffffffffffffffff16639706e0c06040518163ffffffff1660e01b815260040160206040518083038186803b158015611e2757600080fd5b505afa158015611e3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e5f91908101906153bb565b9050611e8e611e8983602001516bffffffffffffffffffffffff168361239490919063ffffffff16565b6132c0565b6bffffffffffffffffffffffff90811660208401526040830151611ebe91611e899184911663ffffffff61239416565b6bffffffffffffffffffffffff16604083015250919050565b601454640100000000900463ffffffff1681565b6000611ef561515e565b506000838152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611f5986613184565b915091506000611f6e84602001518484613241565b915050611f7d878783856132e4565b979650505050505050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60096020526000908152604090205481565b611fbe61511d565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602090815260408083208584529091529020610fcc9061252a565b611fff61268a565b73ffffffffffffffffffffffffffffffffffffffff811661202a57612025610a18613431565b610f73565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600c5460006120b082600163ffffffff61239416565b90506120ba6150ee565b50600081815260166020908152604091829020825160a0810184528154815260018201549281018390526002820154938101939093526003810154606084015260040154608083015261210f57505050610f73565b61211761513d565b50600084815260156020908152604080832085845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526121655750505050610f73565b60008581526015602090815260408083208684529091528120818155600181018290556002018190556121988284613468565b90506000806121ac888486604001516134dd565b9150915087877ff1116b309178aa62dcb6bf8c3b8bc2321724907c7ebf52192d14c8ce3aa9194c84846040516121e39291906155ac565b60405180910390a360006121fd838363ffffffff612aad16565b6080870151909150612215908263ffffffff612aad16565b6080870181905260008881526016602090815260409091206004019190915586015161224890600163ffffffff61239416565b602080880182815260008a81526016909252604090912060010191909155516117f3576080860151865188917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b2916122a6908263ffffffff61239416565b6040516122b49291906155ac565b60405180910390a2505050505050505050565b3360009081526001602052604090205460ff16611d8557611d85610a183361362d565b606063b9588e4360e01b83836040516024016123079291906155f4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b6000828211156123ad576123ad610a1860028585613648565b50900390565b606063614b800a60e01b83836040516024016123079291906155ac565b30318015610f73576123e0610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561242757600080fd5b505af115801561243b573d6000803e3d6000fd5b505050505050565b6000611bd5601754612453610e9a565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161248b919061545e565b60206040518083038186803b1580156124a357600080fd5b505afa1580156124b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506124db91908101906153bb565b9063ffffffff61239416565b4260006124f2611bbc565b90508181111561250957612509610a1882846136ed565b600c5460009061252090600163ffffffff612aad16565b600c555050600d55565b61253261511d565b5060408051606081018252825467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811660208501527401000000000000000000000000000000000000000090920490911692820192909252600c5490918111156125ca576125a58161370a565b67ffffffffffffffff16825260408201516bffffffffffffffffffffffff1660208301525b50919050565b60008183106125df5781610fcc565b5090919050565b60606384c8b7c960e01b83836040516024016123079291906155ac565b61260b61511d565b6126148361252a565b905061263e611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff61239416565b6bffffffffffffffffffffffff1660208201526112fb838261372a565b60005473ffffffffffffffffffffffffffffffffffffffff163314611d8557600054611d8590610a1890339073ffffffffffffffffffffffffffffffffffffffff166137e4565b73ffffffffffffffffffffffffffffffffffffffff81166126f7576126f7610a18613801565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561273157612731610a1882613838565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b61280b83613853565b6128158383612fac565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600660209081526040808320868452909152902061284f908261388a565b6000838152600760205260409020612867908261388a565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe058261388a565b6128a483613853565b6128ae8383612fac565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260066020908152604080832086845290915290206128e890826138e2565b600083815260076020526040902061290090826138e2565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05826138e2565b61293e838361391d565b15612948576112fb565b61295061511d565b6129598461252a565b905061296361511d565b61296c8461252a565b905081604001516bffffffffffffffffffffffff168311156129a7576129a7610a188484604001516bffffffffffffffffffffffff166125e6565b60408201516129ce90611e89906bffffffffffffffffffffffff168563ffffffff61239416565b6bffffffffffffffffffffffff9081166040808501919091528201516129ff91611e8991168563ffffffff612aad16565b6bffffffffffffffffffffffff166040820152612a1c858361372a565b612a26848261372a565b5050505050565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff1633811461166257611662610a183384613924565b620f424063ffffffff82161115612a8b57612a86610a1860008584613941565b6112fb565b8163ffffffff168163ffffffff16106112fb576112fb610a1860018584613941565b600082820183811015610fcc57610fcc610a1860008686613648565b606063eb5108a260e01b82604051602401612ae4919061545e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16612ba157612ba1610a1883612ac9565b6002548110612bbc57612bbc610a1882600280549050613960565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110612be057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614612c4257612c42610a1860028381548110612c1a57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff168461397d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110612cbd57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110612cf057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190612d6f9082615175565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60118590556012805463ffffffff8087167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000092831617909255601385905560148054848416640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff9487169190931617929092161790556040517f613157dbb0e920deab8ad6ddd3805e87cbf57344b9fe780f1764790ec789754290612e6b90879087908790879087906157a2565b60405180910390a15050505050565b606063b56d2df060e01b82604051602401612ae4919061545e565b803414158015612ea457503415155b15610f7357610f73610a18823461399a565b6000828152600a602052604081205481908190612ee99073ffffffffffffffffffffffffffffffffffffffff1686611fb6565b602001516bffffffffffffffffffffffff169050612f0d848263ffffffff61239416565b601254909350612f3890612f2b9063ffffffff16620f4240866139b7565b829063ffffffff612aad16565b9150509250929050565b612f4a61511d565b612f538361252a565b9050612f7d611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff612aad16565b612fb5826139d9565b6000612fc483836000806132e4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832087845290915290209091506130009061252a565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600660209081526040808320888452825291829020845181549286015195909301517fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090921667ffffffffffffffff909316929092177fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff16680100000000000000006bffffffffffffffffffffffff9586160217909216740100000000000000000000000000000000000000009390921692909202179055801561317b576130e58382613a4d565b6130ed610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016131279291906154d7565b602060405180830381600087803b15801561314157600080fd5b505af1158015613155573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061317991908101906152bd565b505b6112fb83613a95565b600080600061319f6001600c5461239490919063ffffffff16565b90506131a961513d565b50600084815260156020908152604080832084845282528083208151606080820184528254825260018084015483870152600293840154838601528787526016865295849020845160a0810186528154815296810154958701959095529184015492850192909252600383015490840152600490910154608083015290613231908290613468565b9350806040015192505050915091565b600080826132515783915061327a565b61326563ffffffff8616620f424086613aa2565b9150613277848363ffffffff61239416565b90505b935093915050565b61328a613ad8565b42600d556001600c55565b61329d613aed565b620d2f00620dbba068056bc75e2d6310000060026003612a268585858585612db7565b806bffffffffffffffffffffffff81168114610c8557610c85610a18600284613b52565b600c546000906132f261511d565b5073ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083208984528252918290208251606081018452905467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811694840194909452740100000000000000000000000000000000000000009091049092169281019290925282141561339357600092505050613429565b61339f81838787613b6f565b81519093506000906133c29067ffffffffffffffff16600163ffffffff612aad16565b90506134006133f38984602001516bffffffffffffffffffffffff16856000015167ffffffffffffffff1685613bf2565b859063ffffffff612aad16565b93506134236133f38984604001516bffffffffffffffffffffffff168487613bf2565b93505050505b949350505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b815160009061347657610fcf565b815183516040840151602086015160608601516014546134ac95949392919063ffffffff80821691640100000000900416613c8b565b608083015183519192506000916134c89163ffffffff61239416565b9050818110156134d6578091505b5092915050565b6000806134e861515e565b506000858152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff1690820181905261354c908686613241565b909350915082156136095761355f610e9a565b81516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092169163a9059cbb916135b59187906004016154d7565b602060405180830381600087803b1580156135cf57600080fd5b505af11580156135e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061360791908101906152bd565b505b8115613624576136198683613d4e565b613624868386613d8f565b50935093915050565b606063b65a25b960e01b82604051602401612ae4919061545e565b606063e946c1bb60e01b848484604051602401613667939291906155ba565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063a6bcde4760e01b83836040516024016123079291906155ac565b8067ffffffffffffffff81168114610c8557610c85610a18600184613b52565b8051825460408301516020909301516bffffffffffffffffffffffff90811668010000000000000000027fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff91909416740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff9094167fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090931692909217929092161716179055565b6060631de45ad160e01b838360405160240161230792919061547f565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b82604051602401612ae4919061545e565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f7357610f73610a18826000613e78565b61389261511d565b61389b8361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff1660408201526112fb838261372a565b6138ea61511d565b6138f38361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b1460011690565b60606382ded78560e01b83836040516024016123079291906154d7565b60606322df959760e01b84848460405160240161366793929190615626565b606063e9f8377160e01b83836040516024016123079291906155ac565b606063140a84db60e01b838360405160240161230792919061547f565b60606331d7a50560e01b83836040516024016123079291906155ac565b6000613429836139cd868563ffffffff613e9516565b9063ffffffff613ec616565b600c546000906139f090600163ffffffff61239416565b90506139fa61513d565b5060008281526015602090815260408083208484528252918290208251606081018452815480825260018301549382019390935260029091015492810192909252156112fb576112fb610a188484613ef0565b6000828152600b6020526040902054613a6c908263ffffffff61239416565b6000838152600b6020526040902055601754613a8e908263ffffffff61239416565b6017555050565b610f738160006001613d8f565b6000613429836139cd613abc82600163ffffffff61239416565b613acc888763ffffffff613e9516565b9063ffffffff612aad16565b600d5415611d8557611d85610a186000613f0d565b60115415801590613b05575060125463ffffffff1615155b8015613b12575060135415155b8015613b25575060145463ffffffff1615155b8015613b405750601454640100000000900463ffffffff1615155b15611d8557611d85610a186001613f0d565b606063c996af7b60e01b83836040516024016123079291906155dc565b6000821580613b7c575081155b15613b8957506000613429565b6000613b9c85600163ffffffff61239416565b865167ffffffffffffffff161015613bb8578560400151613bbe565b85602001515b6bffffffffffffffffffffffff16905080613bdd576000915050613429565b613be88484836139b7565b9695505050505050565b6000831580613c0057508183145b15613c0d57506000613429565b818310613c46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119019061564d565b613c4e615199565b613c588685613f4c565b9050613c62615199565b613c6c8785613f4c565b9050611f7d81600001518260200151846000015185602001518a61406a565b600080613c9888886140f6565b90506000613ca687876140f6565b9050811580613cb3575080155b15613cc4575060009150611f7d9050565b600081831315613cdd57613cd88284614148565b613ce7565b613ce78383614148565b9050613d10613d0b613cf883614167565b8863ffffffff168863ffffffff16614809565b614818565b905081831315613d2957613d248282614148565b613d33565b613d338282614e02565b9050613d3f818c614e2e565b9b9a5050505050505050505050565b6000828152600b6020526040902054613d6d908263ffffffff612aad16565b6000838152600b6020526040902055601754613a8e908263ffffffff612aad16565b6000838152600f6020526040902054600c5480821415613db05750506112fb565b613db8615199565b506000858152600e602090815260408083208584528252918290208251808401909352805483526001015490820152613def615199565b613df882614e70565b15613e3157613e11826000015183602001518888614e79565b60208301819052818352613e259190614edb565b60208301528152613e3c565b602081018590528581525b6000878152600e6020908152604080832086845282528083208451815593820151600190940193909355978152600f9097529095205550505050565b6060639ae94f0160e01b838360405160240161230792919061559c565b600082613ea457506000610fcf565b82820282848281613eb157fe5b0414610fcc57610fcc610a1860018686613648565b600081613edc57613edc610a1860038585613648565b6000828481613ee757fe5b04949350505050565b6060635caa0b0560e01b83836040516024016123079291906155ac565b60607f0b02d77300000000000000000000000000000000000000000000000000000000826001811115613f3c57fe5b604051602401612ae4919061580e565b613f54615199565b506000828152600e602090815260408083208484528252918290208251808401909352805483526001015490820152613f8c81614e70565b15613f9657610fcf565b6000613fa983600163ffffffff61239416565b6000858152600e60209081526040808320848452825291829020825180840190935280548352600101549082015292509050613fe482614e70565b15613fef5750610fcf565b6000848152600f60205260409020548381101561404c576000858152600e602090815260408083208484528252918290208251808401909352805483526001015490820152925061403f83614e70565b1561404c5750610fcf9050565b50506040805180820190915260008152600160208201529392505050565b600081614079575060006140ed565b8361409957614092856139cd848963ffffffff613e9516565b90506140ed565b60006140be6140ae868863ffffffff613e9516565b6124db898763ffffffff613e9516565b905060006140d2828663ffffffff613ec616565b90506140e8876139cd868463ffffffff613e9516565b925050505b95945050505050565b60008083121561410e5761410e610a18600185614f04565b600082121561412557614125610a18600184614f04565b610fcc614142846f80000000000000000000000000000000614f45565b83614f8d565b6000610fcc614142846f80000000000000000000000000000000614f45565b60006f8000000000000000000000000000000082131561418f5761418f610a1860018461500e565b600082136141a5576141a5610a1860008461500e565b6f800000000000000000000000000000008214156141c557506000610c85565b640733048c5a82136141f857507fffffffffffffffffffffffffffffffe010000000000000000000000000000000610c85565b60008060006a01c8464f761647600000008513614257577ffffffffffffffffffffffffffffffff000000000000000000000000000000000909301926a01c8464f761647600000006f8000000000000000000000000000000086020594505b6cf1aaddd7742e9000000000000085136142b5577ffffffffffffffffffffffffffffffff800000000000000000000000000000000909301926cf1aaddd7742e900000000000006f8000000000000000000000000000000086020594505b6e0afe10820813d780000000000000008513614317577ffffffffffffffffffffffffffffffffc00000000000000000000000000000000909301926e0afe10820813d780000000000000006f8000000000000000000000000000000086020594505b6f02582ab704279ec00000000000000000851361437b577ffffffffffffffffffffffffffffffffe00000000000000000000000000000000909301926f02582ab704279ec000000000000000006f8000000000000000000000000000000086020594505b6f1152aaa3bf81cc00000000000000000085136143df577fffffffffffffffffffffffffffffffff00000000000000000000000000000000909301926f1152aaa3bf81cc0000000000000000006f8000000000000000000000000000000086020594505b6f2f16ac6c59de700000000000000000008513614443577fffffffffffffffffffffffffffffffff80000000000000000000000000000000909301926f2f16ac6c59de700000000000000000006f8000000000000000000000000000000086020594505b6f4da2cbf1be582800000000000000000085136144a7577fffffffffffffffffffffffffffffffffc0000000000000000000000000000000909301926f4da2cbf1be58280000000000000000006f8000000000000000000000000000000086020594505b6f63afbe7ab2082c000000000000000000851361450b577fffffffffffffffffffffffffffffffffe0000000000000000000000000000000909301926f63afbe7ab2082c0000000000000000006f8000000000000000000000000000000086020594505b6f70f5a893b608861e1f58934f97aea57d851361456f577ffffffffffffffffffffffffffffffffff0000000000000000000000000000000909301926f70f5a893b608861e1f58934f97aea57d6f8000000000000000000000000000000086020594505b7fffffffffffffffffffffffffffffffff80000000000000000000000000000000850192508291506f80000000000000000000000000000000828002059050700100000000000000000000000000000000838103830205840193506f80000000000000000000000000000000818302816145e557fe5b059150700200000000000000000000000000000000836faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0383028161461657fe5b05840193506f800000000000000000000000000000008183028161463657fe5b059150700300000000000000000000000000000000836f999999999999999999999999999999990383028161466757fe5b05840193506f800000000000000000000000000000008183028161468757fe5b059150700400000000000000000000000000000000836f92492492492492492492492492492492038302816146b857fe5b05840193506f80000000000000000000000000000000818302816146d857fe5b059150700500000000000000000000000000000000836f8e38e38e38e38e38e38e38e38e38e38e0383028161470957fe5b05840193506f800000000000000000000000000000008183028161472957fe5b059150700600000000000000000000000000000000836f8ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b0383028161475a57fe5b05840193506f800000000000000000000000000000008183028161477a57fe5b059150700700000000000000000000000000000000836f89d89d89d89d89d89d89d89d89d89d89038302816147ab57fe5b05840193506f80000000000000000000000000000000818302816147cb57fe5b059150700800000000000000000000000000000000836f88888888888888888888888888888888038302816147fc57fe5b0584019350505050919050565b60006134296141428585614f45565b60007fffffffffffffffffffffffffffffffe01000000000000000000000000000000082121561484a57506000610c85565b8161486657506f80000000000000000000000000000000610c85565b600082131561487d5761487d610a1860018461500e565b6f800000000000000000000000000000006f1000000000000000000000000000000083078080028290056710e1b3be415a0000810293909301929091818302059050806705a0913f6b1e000002830192506f80000000000000000000000000000000828202816148e957fe5b05905080670168244fdac7800002830192506f800000000000000000000000000000008282028161491657fe5b05905080664807432bc1800002830192506f800000000000000000000000000000008282028161494257fe5b05905080660c0135dca0400002830192506f800000000000000000000000000000008282028161496e57fe5b059050806601b707b1cdc00002830192506f800000000000000000000000000000008282028161499a57fe5b059050806536e0f639b80002830192506f80000000000000000000000000000000828202816149c557fe5b05905080650618fee9f80002830192506f80000000000000000000000000000000828202816149f057fe5b05905080649c197dcc0002830192506f8000000000000000000000000000000082820281614a1a57fe5b05905080640e30dce40002830192506f8000000000000000000000000000000082820281614a4457fe5b0590508064012ebd130002830192506f8000000000000000000000000000000082820281614a6e57fe5b059050806317499f0002830192506f8000000000000000000000000000000082820281614a9757fe5b059050806301a9d48002830192506f8000000000000000000000000000000082820281614ac057fe5b05905080621c638002830192506f8000000000000000000000000000000082820281614ae857fe5b059050806201c63802830192506f8000000000000000000000000000000082820281614b1057fe5b05905080611ab802830192506f8000000000000000000000000000000082820281614b3757fe5b0590508061017c02830192506f8000000000000000000000000000000082820281614b5e57fe5b05905080601402830192506f8000000000000000000000000000000082820281614b8457fe5b600095909503946721c3677c82b400009190059384010582016f8000000000000000000000000000000001929050701000000000000000000000000000000000841615614bf3577243cbaf42a000812488fc5c220ad7b97bf6e99e6cf1aaddd7742e56d32fb9f9974484020592505b700800000000000000000000000000000000841615614c35577105d27a9f51c31b7c2f8038212a05747799916e0afe10820813d65dfe6a33c07f738f84020592505b700400000000000000000000000000000000841615614c7757701b4c902e273a58678d6d3bfdb93db96d026f02582ab704279e8efd15e0265855c47a84020592505b700200000000000000000000000000000000841615614cb9577003b1cc971a9bb5b9867477440d6d1577506f1152aaa3bf81cb9fdb76eae12d02957184020592505b700100000000000000000000000000000000841615614cfb5770015bf0a8b1457695355fb8ac404e7a79e36f2f16ac6c59de6f8d5d6f63c1482a7c8684020592505b6f80000000000000000000000000000000841615614d3b576fd3094c70f034de4b96ff7d5b6f99fcd86f4da2cbf1be5827f9eb3ad1aa9866ebb384020592505b6f40000000000000000000000000000000841615614d7b576fa45af1e1f40c333b3de1db4dd55f29a76f63afbe7ab2082ba1a0ae5e4eb1b479dc84020592505b6f20000000000000000000000000000000841615614dbb576f910b022db7ae67ce76b441c27035c6a16f70f5a893b608861e1f58934f97aea57d84020592505b6f10000000000000000000000000000000841615614dfb576f88415abbe9a76bead8d00cf112e4d4a86f783eafef1c0a8f3978c7f81824d62ebf84020592505b5050919050565b60006f80000000000000000000000000000000614e1f8484614f45565b81614e2657fe5b059392505050565b600080821215614e4657614e46610a18600184614f04565b6000614e528484614f45565b905060008113614e66576000915050610fcf565b607f1c9392505050565b60200151151590565b60008085614e8b575082905081614ed2565b83614e9a575084905083614ed2565b614ebd614ead858763ffffffff613e9516565b613acc888663ffffffff613e9516565b9150614ecf858463ffffffff613e9516565b90505b94509492505050565b600080614ef984846f8000000000000000000000000000000061503d565b915091509250929050565b60607fbd79545f00000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b8360405160240161230792919061581c565b600082614f5457506000610fcf565b5081810281838281614f6257fe5b05141580614f79575082828281614f7557fe5b0514155b15610fcf57610fcf610a18600185856150ab565b600081614fa357614fa3610a18600285856150ab565b7f800000000000000000000000000000000000000000000000000000000000000083148015614ff15750817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff145b1561500557615005610a18600385856150ab565b818381614e2657fe5b60607fed2f26a100000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b6000808285118061504d57508284115b156150a2576000848610156150625784615064565b855b9050615076818563ffffffff613ec616565b9050615088868263ffffffff613ec616565b925061509a858263ffffffff613ec616565b91505061327a565b50929391925050565b60607f8c12dfe7000000000000000000000000000000000000000000000000000000008460038111156150da57fe5b84846040516024016136679392919061582f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180606001604052806000815260200160008152602001600081525090565b604080518082019091526000808252602082015290565b8154818355818111156112fb576000838152602090206112fb9181019083016151b3565b604051806040016040528060008152602001600081525090565b610bed91905b808211156151cd57600081556001016151b9565b5090565b6000604082840312156125ca578081fd5b6000602082840312156151f3578081fd5b8135610fcc81615854565b60006020828403121561520f578081fd5b8151610fcc81615854565b60008060006060848603121561522e578182fd5b833561523981615854565b9250602084013561524981615854565b929592945050506040919091013590565b6000806040838503121561526c578182fd5b823561527781615854565b946020939093013593505050565b60008060408385031215615297578182fd5b82356152a281615854565b915060208301356152b281615884565b809150509250929050565b6000602082840312156152ce578081fd5b8151610fcc81615876565b6000602082840312156152ea578081fd5b5035919050565b60008060408385031215615303578182fd5b8235915060208301356152b281615854565b60008060408385031215615327578182fd5b50508035926020909101359150565b60008060408385031215615348578182fd5b82359150602083013563ffffffff811681146152b2578182fd5b600060208284031215615373578081fd5b8135610fcc81615884565b600080600060a08486031215615392578283fd5b61539c85856151d1565b92506153ab85604086016151d1565b9150608084013590509250925092565b6000602082840312156153cc578081fd5b5051919050565b600080600080600060a086880312156153ea578283fd5b8535945060208601356153fc81615891565b935060408601359250606086013561541381615891565b9150608086013561542381615891565b809150509295509295909350565b60008060408385031215615443578182fd5b823561544e81615891565b915060208301356152b281615876565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000918401906040840190835b8181101561554b57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101615517565b509095945050505050565b901515815260200190565b90815260200190565b92835273ffffffffffffffffffffffffffffffffffffffff91909116602083015263ffffffff16604082015260600190565b9182521515602082015260400190565b918252602082015260400190565b60608101600485106155c857fe5b938152602081019290925260409091015290565b60408101600384106155ea57fe5b9281526020015290565b604081016156018461584a565b92815273ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b606081016156338561584a565b938152602081019290925263ffffffff1660409091015290565b60208082526013908201527f43525f494e54455256414c5f494e56414c494400000000000000000000000000604082015260600190565b60208082526014908201527f574554485f5452414e534645525f4641494c4544000000000000000000000000604082015260600190565b81518152602080830151908201526040918201519181019190915260600190565b815173ffffffffffffffffffffffffffffffffffffffff16815260209182015163ffffffff169181019190915260400190565b815167ffffffffffffffff1681526020808301516bffffffffffffffffffffffff90811691830191909152604092830151169181019190915260600190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b948552602085019390935260408401919091526060830152608082015260a00190565b94855263ffffffff938416602086015260408501929092528216606084015216608082015260a00190565b92835260ff918216602084015216604082015260600190565b63ffffffff91909116815260200190565b63ffffffff92831681529116602082015260400190565b60ff91909116815260200190565b60ff929092168252602082015260400190565b60ff9390931683526020830191909152604082015260600190565b60028110610f7357fe5b73ffffffffffffffffffffffffffffffffffffffff81168114610f7357600080fd5b8015158114610f7357600080fd5b60028110610f7357600080fd5b63ffffffff81168114610f7357600080fdfea365627a7a723158204003618f6c03f1af7bc4ce4395045c4daf1b1bb0cfdb9b3a5cb30deba631ee256c6578706572696d656e74616cf564736f6c634300050c0040" + }, + "deployedBytecode": { + "object": "0x6080604052600436106103555760003560e01c80639051c3ee116101bb578063bb7ef7e0116100f7578063e8eeb3f811610095578063f18765321161006f578063f187653214610955578063f252b7a114610975578063f2fde38b14610995578063ff691b11146109b557610355565b8063e8eeb3f81461090b578063e907f00314610920578063ee99205c1461094057610355565b8063dcb31f76116100d1578063dcb31f76146108ac578063e0ee036e146108c1578063e1c7392a146108d6578063e804d0a4146108eb57610355565b8063bb7ef7e01461084a578063c18c91411461086a578063d39de6e91461088a57610355565b8063a694fc3a11610164578063b2baa33e1161013e578063b2baa33e146107d5578063b3e33379146107ea578063b510879f1461080a578063b91816111461082a57610355565b8063a694fc3a14610780578063abe0906a146107a0578063b0531524146107c057610355565b8063a26171e211610195578063a26171e214610743578063a3b4a32714610758578063a657e5791461076b57610355565b80639051c3ee146106ee5780639ad26744146107035780639c3ccc821461072357610355565b80634e67339f116102955780636340380111610233578063766718081161020d578063766718081461068257806381666796146106975780638a2e271a146106b95780638da5cb5b146106d957610355565b8063634038011461062d57806368a7d6cd14610642578063707129391461066257610355565b80635bd4ab731161026f5780635bd4ab73146105a55780635d91121d146105d25780635e615a6b146105f2578063624a72321461061857610355565b80634e67339f14610550578063587da0231461057057806358f6c7e31461058557610355565b80633c277fc51161030257806344a6958b116102dc57806344a6958b146104b657806346b97959146104d6578063494503d4146105035780634bcc3f671461052357610355565b80633c277fc5146104475780633e4ad7321461046957806342f1181e1461049657610355565b80632a94c279116103335780632a94c279146103c75780632e17de78146103f657806338229d931461041657610355565b806301e28d841461035a5780630b9663db1461037c5780631e7ff8f6146103a7575b600080fd5b34801561036657600080fd5b5061037a6103753660046151e2565b6109d5565b005b34801561038857600080fd5b50610391610aa3565b60405161039e9190615561565b60405180910390f35b3480156103b357600080fd5b506103916103c23660046151e2565b610bf0565b3480156103d357600080fd5b506103e76103e2366004615315565b610c8a565b60405161039e9392919061574e565b34801561040257600080fd5b5061037a6104113660046152d9565b610cb6565b34801561042257600080fd5b506104366104313660046152d9565b610e6b565b60405161039e95949392919061577f565b34801561045357600080fd5b5061045c610e9a565b60405161039e919061545e565b34801561047557600080fd5b506104896104843660046152d9565b610f43565b60405161039e919061570f565b3480156104a257600080fd5b5061037a6104b13660046151e2565b610f62565b3480156104c257600080fd5b506104896104d1366004615285565b610f76565b3480156104e257600080fd5b506104f66104f13660046152d9565b610fd5565b60405161039e91906156bb565b34801561050f57600080fd5b5061045c61051e3660046152d9565b611020565b34801561052f57600080fd5b5061054361053e3660046152d9565b611054565b60405161039e91906156dc565b34801561055c57600080fd5b5061037a61056b3660046151e2565b6110b6565b34801561057c57600080fd5b506103916110fd565b34801561059157600080fd5b5061037a6105a036600461537e565b611103565b3480156105b157600080fd5b506105c56105c03660046151e2565b611300565b60405161039e9190615556565b3480156105de57600080fd5b5061037a6105ed366004615336565b611315565b3480156105fe57600080fd5b506106076113de565b60405161039e9594939291906157a2565b34801561062457600080fd5b5061045c611407565b34801561063957600080fd5b50610391611472565b34801561064e57600080fd5b5061039161065d366004615431565b611478565b34801561066e57600080fd5b5061037a61067d3660046151e2565b6115b1565b34801561068e57600080fd5b50610391611666565b3480156106a357600080fd5b506106ac61166c565b60405161039e91906157e6565b3480156106c557600080fd5b5061037a6106d43660046151e2565b611678565b3480156106e557600080fd5b5061045c61173a565b3480156106fa57600080fd5b5061045c611756565b34801561070f57600080fd5b5061037a61071e36600461525a565b611772565b34801561072f57600080fd5b5061037a61073e3660046153d3565b611784565b34801561074f57600080fd5b506103916117fe565b61037a61076636600461521a565b611804565b34801561077757600080fd5b50610391611a54565b34801561078c57600080fd5b5061037a61079b3660046152d9565b611a5a565b3480156107ac57600080fd5b5061037a6107bb3660046151e2565b611b6f565b3480156107cc57600080fd5b50610391611bb6565b3480156107e157600080fd5b50610391611bbc565b3480156107f657600080fd5b5061037a6108053660046152d9565b611bda565b34801561081657600080fd5b5061037a6108253660046152d9565b611c1a565b34801561083657600080fd5b506105c56108453660046151e2565b611c24565b34801561085657600080fd5b506103916108653660046152d9565b611c39565b34801561087657600080fd5b506103916108853660046152d9565b611cc4565b34801561089657600080fd5b5061089f611cd6565b60405161039e91906154fd565b3480156108b857600080fd5b5061045c611d45565b3480156108cd57600080fd5b506106ac611d61565b3480156108e257600080fd5b5061037a611d6d565b3480156108f757600080fd5b50610489610906366004615362565b611d87565b34801561091757600080fd5b506106ac611ed7565b34801561092c57600080fd5b5061039161093b3660046152f1565b611eeb565b34801561094c57600080fd5b5061045c611f88565b34801561096157600080fd5b506103916109703660046151e2565b611fa4565b34801561098157600080fd5b5061048961099036600461525a565b611fb6565b3480156109a157600080fd5b5061037a6109b03660046151e2565b611ff7565b3480156109c157600080fd5b5061037a6109d03660046152d9565b61209a565b6109dd6122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16610a1d57610a1d610a186001836122ea565b61238c565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517ff50d0d312d501878616eb5e78ebf3ed6dcd3955aaef8165af9c6b057cc4832fb90610a9890839061545e565b60405180910390a150565b600c5460009081610abb82600163ffffffff61239416565b6000818152601660205260409020600101549091508015610ae357610ae3610a1883836123b3565b610aeb6123d0565b610af3612443565b600084815260166020526040902055610b0a6150ee565b50600083815260166020908152604091829020825160a08101845281548082526001830154938201849052600283015482860181905260038401546060840181905260049094015460808401529451919488947fbb4a26fa0ace13ee4da343896c20eaa44a618fb9071fdd8c2e2c960a4583189d94610b8c9491939291615764565b60405180910390a2610b9c6124e7565b6020810151610be357805160405185917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b291610bda916000916155ac565b60405180910390a25b6020015193505050505b90565b6000610bfa611407565b73ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401610c32919061545e565b60206040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c8291908101906153bb565b90505b919050565b601560209081526000928352604080842090915290825290208054600182015460029092015490919083565b33610cbf61511d565b73ffffffffffffffffffffffffffffffffffffffff821660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610d0c9061252a565b90506000610d3e82602001516bffffffffffffffffffffffff1683604001516bffffffffffffffffffffffff166125d0565b905080841115610d5557610d55610a1885836125e6565b73ffffffffffffffffffffffffffffffffffffffff831660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610da39085612603565b610dab611407565b73ffffffffffffffffffffffffffffffffffffffff16639470b0bd84866040518363ffffffff1660e01b8152600401610de59291906154d7565b600060405180830381600087803b158015610dff57600080fd5b505af1158015610e13573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd85604051610e5d9190615561565b60405180910390a250505050565b601660205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcb31f766040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f3d91908101906151fe565b91505090565b610f4b61511d565b6000828152600760205260409020610c829061252a565b610f6a61268a565b610f73816126d1565b50565b610f7e61511d565b610fcc60056000846001811115610f9157fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff88168252909252902061252a565b90505b92915050565b610fdd61513d565b506000908152601560209081526040808320600c548452825291829020825160608101845281548152600182015492810192909252600201549181019190915290565b6002818154811061102d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61105c61515e565b506000908152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff169082015290565b601980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5481565b338161110f57506112fb565b600061111e6020860186615362565b600181111561112957fe5b14801561114d575060006111406020850185615362565b600181111561114b57fe5b145b1561115857506112fb565b60016111676020860186615362565b600181111561117257fe5b14156111875761118784602001358284612802565b60016111966020850185615362565b60018111156111a157fe5b14156111b6576111b68360200135828461289b565b60006005816111c86020880188615362565b60018111156111d357fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff861682528352908120925090600590829061121d90880188615362565b600181111561122857fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff871682529092529020905061126b828286612934565b60208086013590870180359073ffffffffffffffffffffffffffffffffffffffff8616907f7d3ad1dcf03b9027064d1d9a474a69e0cecc31324c541d3eb9b5e6fa2f106c8d9088906112bd908c615362565b60018111156112c857fe5b6112d560208c018c615362565b60018111156112e057fe5b6040516112ef939291906157cd565b60405180910390a45050505b505050565b60106020526000908152604090205460ff1681565b8161131f81612a2d565b6000838152600a602052604090205474010000000000000000000000000000000000000000900463ffffffff16611357848285612a66565b6000848152600a60205260409081902080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8716021790555184907f8ea2a7a959bd25f226b7b0a4393613f7fdcaa8404e8bad96aa52dc1c1459016790610e5d90849087906157f7565b601154601254601354601454929363ffffffff9283169391928281169264010000000090041690565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639051c3ee6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b60115481565b600854600090339061149190600163ffffffff612aad16565b600881905591506114a682620f424086612a66565b6114ae61515e565b5060408051808201825273ffffffffffffffffffffffffffffffffffffffff838116825263ffffffff87811660208085019182526000888152600a9091528590208451815492517fffffffffffffffffffffffff00000000000000000000000000000000000000009093169416939093177fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000919092160217905590517fcec6fc86ea644053f6edff1160dfe3fa5c61e7a5ef9f873f145bb03a0bd319e7906115929085908590899061556a565b60405180910390a183156115a9576115a983611bda565b505092915050565b6115b961268a565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166115f2576115f2610a1882612ac9565b60005b600254811015611662578173ffffffffffffffffffffffffffffffffffffffff166002828154811061162357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561165a576116558282612b68565b611662565b6001016115f5565b5050565b600c5481565b60145463ffffffff1681565b6116806122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16156116bc576116bc610a186000836122ea565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f3e535d1ab441ef41c268fd9b52b478aee02d693c5ca2a84b5d26b89e0922e5e190610a9890839061545e565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60195473ffffffffffffffffffffffffffffffffffffffff1681565b61177a61268a565b6116628282612b68565b61178c6122c7565b6117998585858585612db7565b3073ffffffffffffffffffffffffffffffffffffffff1663c6f3a4276040518163ffffffff1660e01b815260040160006040518083038186803b1580156117df57600080fd5b505afa1580156117f3573d6000803e3d6000fd5b505050505050505050565b60135481565b3360009081526010602052604090205460ff1661182757611827610a1833612e7a565b61183081612e95565b3461190a5761183d610e9a565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd8330846040518463ffffffff1660e01b8152600401611879939291906154a6565b602060405180830381600087803b15801561189357600080fd5b505af11580156118a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118cb91908101906152bd565b61190a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190190615684565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152600960205260409020548061193b57506112fb565b600061194682610f43565b602001516bffffffffffffffffffffffff16905060135481101561196b5750506112fb565b600c54600083815260156020908152604080832084845282528083206016909252909120815480611a1a576000806119a38888612eb6565b6002870182905560018701819055600386015491935091506119cb908263ffffffff612aad16565b60038501556001808501546119e59163ffffffff612aad16565b6001850155604051889087907f14b098103235344975b17508c2391721cc9ac3f3fa2b56c7ff46f8480dfd074f90600090a350505b611a2a818863ffffffff612aad16565b83556002820154611a41908863ffffffff612aad16565b8260020181905550505050505050505050565b60085481565b33611a63611407565b73ffffffffffffffffffffffffffffffffffffffff166315cc36f282846040518363ffffffff1660e01b8152600401611a9d9291906154d7565b600060405180830381600087803b158015611ab757600080fd5b505af1158015611acb573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff811660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020611b1d9083612f42565b8073ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a83604051611b639190615561565b60405180910390a25050565b601880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60175481565b6000611bd5601154600d54612aad90919063ffffffff16565b905090565b3360008181526009602052604080822084905551839183917f5640833634fce74eb9211d1209a91dd5a1c8c6a751696bff9323b4db67f815139190a35050565b610f738133612fac565b60016020526000908152604090205460ff1681565b6000611c4361515e565b506000828152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611ca785613184565b91509150611cba83602001518383613241565b5095945050505050565b600b6020526000908152604090205481565b60606002805480602002602001604051908101604052809291908181526020018280548015611d3b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611d10575b5050505050905090565b60185473ffffffffffffffffffffffffffffffffffffffff1681565b60125463ffffffff1681565b611d756122c7565b611d7d613282565b611d85613295565b565b611d8f61511d565b60016000526004602052611dc27fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0561252a565b90506000826001811115611dd257fe5b1415610c85576000611de2611407565b73ffffffffffffffffffffffffffffffffffffffff16639706e0c06040518163ffffffff1660e01b815260040160206040518083038186803b158015611e2757600080fd5b505afa158015611e3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e5f91908101906153bb565b9050611e8e611e8983602001516bffffffffffffffffffffffff168361239490919063ffffffff16565b6132c0565b6bffffffffffffffffffffffff90811660208401526040830151611ebe91611e899184911663ffffffff61239416565b6bffffffffffffffffffffffff16604083015250919050565b601454640100000000900463ffffffff1681565b6000611ef561515e565b506000838152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611f5986613184565b915091506000611f6e84602001518484613241565b915050611f7d878783856132e4565b979650505050505050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60096020526000908152604090205481565b611fbe61511d565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602090815260408083208584529091529020610fcc9061252a565b611fff61268a565b73ffffffffffffffffffffffffffffffffffffffff811661202a57612025610a18613431565b610f73565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600c5460006120b082600163ffffffff61239416565b90506120ba6150ee565b50600081815260166020908152604091829020825160a0810184528154815260018201549281018390526002820154938101939093526003810154606084015260040154608083015261210f57505050610f73565b61211761513d565b50600084815260156020908152604080832085845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526121655750505050610f73565b60008581526015602090815260408083208684529091528120818155600181018290556002018190556121988284613468565b90506000806121ac888486604001516134dd565b9150915087877ff1116b309178aa62dcb6bf8c3b8bc2321724907c7ebf52192d14c8ce3aa9194c84846040516121e39291906155ac565b60405180910390a360006121fd838363ffffffff612aad16565b6080870151909150612215908263ffffffff612aad16565b6080870181905260008881526016602090815260409091206004019190915586015161224890600163ffffffff61239416565b602080880182815260008a81526016909252604090912060010191909155516117f3576080860151865188917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b2916122a6908263ffffffff61239416565b6040516122b49291906155ac565b60405180910390a2505050505050505050565b3360009081526001602052604090205460ff16611d8557611d85610a183361362d565b606063b9588e4360e01b83836040516024016123079291906155f4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b6000828211156123ad576123ad610a1860028585613648565b50900390565b606063614b800a60e01b83836040516024016123079291906155ac565b30318015610f73576123e0610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561242757600080fd5b505af115801561243b573d6000803e3d6000fd5b505050505050565b6000611bd5601754612453610e9a565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161248b919061545e565b60206040518083038186803b1580156124a357600080fd5b505afa1580156124b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506124db91908101906153bb565b9063ffffffff61239416565b4260006124f2611bbc565b90508181111561250957612509610a1882846136ed565b600c5460009061252090600163ffffffff612aad16565b600c555050600d55565b61253261511d565b5060408051606081018252825467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811660208501527401000000000000000000000000000000000000000090920490911692820192909252600c5490918111156125ca576125a58161370a565b67ffffffffffffffff16825260408201516bffffffffffffffffffffffff1660208301525b50919050565b60008183106125df5781610fcc565b5090919050565b60606384c8b7c960e01b83836040516024016123079291906155ac565b61260b61511d565b6126148361252a565b905061263e611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff61239416565b6bffffffffffffffffffffffff1660208201526112fb838261372a565b60005473ffffffffffffffffffffffffffffffffffffffff163314611d8557600054611d8590610a1890339073ffffffffffffffffffffffffffffffffffffffff166137e4565b73ffffffffffffffffffffffffffffffffffffffff81166126f7576126f7610a18613801565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561273157612731610a1882613838565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b61280b83613853565b6128158383612fac565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600660209081526040808320868452909152902061284f908261388a565b6000838152600760205260409020612867908261388a565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe058261388a565b6128a483613853565b6128ae8383612fac565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260066020908152604080832086845290915290206128e890826138e2565b600083815260076020526040902061290090826138e2565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05826138e2565b61293e838361391d565b15612948576112fb565b61295061511d565b6129598461252a565b905061296361511d565b61296c8461252a565b905081604001516bffffffffffffffffffffffff168311156129a7576129a7610a188484604001516bffffffffffffffffffffffff166125e6565b60408201516129ce90611e89906bffffffffffffffffffffffff168563ffffffff61239416565b6bffffffffffffffffffffffff9081166040808501919091528201516129ff91611e8991168563ffffffff612aad16565b6bffffffffffffffffffffffff166040820152612a1c858361372a565b612a26848261372a565b5050505050565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff1633811461166257611662610a183384613924565b620f424063ffffffff82161115612a8b57612a86610a1860008584613941565b6112fb565b8163ffffffff168163ffffffff16106112fb576112fb610a1860018584613941565b600082820183811015610fcc57610fcc610a1860008686613648565b606063eb5108a260e01b82604051602401612ae4919061545e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16612ba157612ba1610a1883612ac9565b6002548110612bbc57612bbc610a1882600280549050613960565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110612be057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614612c4257612c42610a1860028381548110612c1a57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff168461397d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110612cbd57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110612cf057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190612d6f9082615175565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60118590556012805463ffffffff8087167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000092831617909255601385905560148054848416640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff9487169190931617929092161790556040517f613157dbb0e920deab8ad6ddd3805e87cbf57344b9fe780f1764790ec789754290612e6b90879087908790879087906157a2565b60405180910390a15050505050565b606063b56d2df060e01b82604051602401612ae4919061545e565b803414158015612ea457503415155b15610f7357610f73610a18823461399a565b6000828152600a602052604081205481908190612ee99073ffffffffffffffffffffffffffffffffffffffff1686611fb6565b602001516bffffffffffffffffffffffff169050612f0d848263ffffffff61239416565b601254909350612f3890612f2b9063ffffffff16620f4240866139b7565b829063ffffffff612aad16565b9150509250929050565b612f4a61511d565b612f538361252a565b9050612f7d611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff612aad16565b612fb5826139d9565b6000612fc483836000806132e4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832087845290915290209091506130009061252a565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600660209081526040808320888452825291829020845181549286015195909301517fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090921667ffffffffffffffff909316929092177fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff16680100000000000000006bffffffffffffffffffffffff9586160217909216740100000000000000000000000000000000000000009390921692909202179055801561317b576130e58382613a4d565b6130ed610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016131279291906154d7565b602060405180830381600087803b15801561314157600080fd5b505af1158015613155573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061317991908101906152bd565b505b6112fb83613a95565b600080600061319f6001600c5461239490919063ffffffff16565b90506131a961513d565b50600084815260156020908152604080832084845282528083208151606080820184528254825260018084015483870152600293840154838601528787526016865295849020845160a0810186528154815296810154958701959095529184015492850192909252600383015490840152600490910154608083015290613231908290613468565b9350806040015192505050915091565b600080826132515783915061327a565b61326563ffffffff8616620f424086613aa2565b9150613277848363ffffffff61239416565b90505b935093915050565b61328a613ad8565b42600d556001600c55565b61329d613aed565b620d2f00620dbba068056bc75e2d6310000060026003612a268585858585612db7565b806bffffffffffffffffffffffff81168114610c8557610c85610a18600284613b52565b600c546000906132f261511d565b5073ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083208984528252918290208251606081018452905467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811694840194909452740100000000000000000000000000000000000000009091049092169281019290925282141561339357600092505050613429565b61339f81838787613b6f565b81519093506000906133c29067ffffffffffffffff16600163ffffffff612aad16565b90506134006133f38984602001516bffffffffffffffffffffffff16856000015167ffffffffffffffff1685613bf2565b859063ffffffff612aad16565b93506134236133f38984604001516bffffffffffffffffffffffff168487613bf2565b93505050505b949350505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b815160009061347657610fcf565b815183516040840151602086015160608601516014546134ac95949392919063ffffffff80821691640100000000900416613c8b565b608083015183519192506000916134c89163ffffffff61239416565b9050818110156134d6578091505b5092915050565b6000806134e861515e565b506000858152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff1690820181905261354c908686613241565b909350915082156136095761355f610e9a565b81516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092169163a9059cbb916135b59187906004016154d7565b602060405180830381600087803b1580156135cf57600080fd5b505af11580156135e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061360791908101906152bd565b505b8115613624576136198683613d4e565b613624868386613d8f565b50935093915050565b606063b65a25b960e01b82604051602401612ae4919061545e565b606063e946c1bb60e01b848484604051602401613667939291906155ba565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063a6bcde4760e01b83836040516024016123079291906155ac565b8067ffffffffffffffff81168114610c8557610c85610a18600184613b52565b8051825460408301516020909301516bffffffffffffffffffffffff90811668010000000000000000027fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff91909416740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff9094167fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090931692909217929092161716179055565b6060631de45ad160e01b838360405160240161230792919061547f565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b82604051602401612ae4919061545e565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f7357610f73610a18826000613e78565b61389261511d565b61389b8361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff1660408201526112fb838261372a565b6138ea61511d565b6138f38361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b1460011690565b60606382ded78560e01b83836040516024016123079291906154d7565b60606322df959760e01b84848460405160240161366793929190615626565b606063e9f8377160e01b83836040516024016123079291906155ac565b606063140a84db60e01b838360405160240161230792919061547f565b60606331d7a50560e01b83836040516024016123079291906155ac565b6000613429836139cd868563ffffffff613e9516565b9063ffffffff613ec616565b600c546000906139f090600163ffffffff61239416565b90506139fa61513d565b5060008281526015602090815260408083208484528252918290208251606081018452815480825260018301549382019390935260029091015492810192909252156112fb576112fb610a188484613ef0565b6000828152600b6020526040902054613a6c908263ffffffff61239416565b6000838152600b6020526040902055601754613a8e908263ffffffff61239416565b6017555050565b610f738160006001613d8f565b6000613429836139cd613abc82600163ffffffff61239416565b613acc888763ffffffff613e9516565b9063ffffffff612aad16565b600d5415611d8557611d85610a186000613f0d565b60115415801590613b05575060125463ffffffff1615155b8015613b12575060135415155b8015613b25575060145463ffffffff1615155b8015613b405750601454640100000000900463ffffffff1615155b15611d8557611d85610a186001613f0d565b606063c996af7b60e01b83836040516024016123079291906155dc565b6000821580613b7c575081155b15613b8957506000613429565b6000613b9c85600163ffffffff61239416565b865167ffffffffffffffff161015613bb8578560400151613bbe565b85602001515b6bffffffffffffffffffffffff16905080613bdd576000915050613429565b613be88484836139b7565b9695505050505050565b6000831580613c0057508183145b15613c0d57506000613429565b818310613c46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119019061564d565b613c4e615199565b613c588685613f4c565b9050613c62615199565b613c6c8785613f4c565b9050611f7d81600001518260200151846000015185602001518a61406a565b600080613c9888886140f6565b90506000613ca687876140f6565b9050811580613cb3575080155b15613cc4575060009150611f7d9050565b600081831315613cdd57613cd88284614148565b613ce7565b613ce78383614148565b9050613d10613d0b613cf883614167565b8863ffffffff168863ffffffff16614809565b614818565b905081831315613d2957613d248282614148565b613d33565b613d338282614e02565b9050613d3f818c614e2e565b9b9a5050505050505050505050565b6000828152600b6020526040902054613d6d908263ffffffff612aad16565b6000838152600b6020526040902055601754613a8e908263ffffffff612aad16565b6000838152600f6020526040902054600c5480821415613db05750506112fb565b613db8615199565b506000858152600e602090815260408083208584528252918290208251808401909352805483526001015490820152613def615199565b613df882614e70565b15613e3157613e11826000015183602001518888614e79565b60208301819052818352613e259190614edb565b60208301528152613e3c565b602081018590528581525b6000878152600e6020908152604080832086845282528083208451815593820151600190940193909355978152600f9097529095205550505050565b6060639ae94f0160e01b838360405160240161230792919061559c565b600082613ea457506000610fcf565b82820282848281613eb157fe5b0414610fcc57610fcc610a1860018686613648565b600081613edc57613edc610a1860038585613648565b6000828481613ee757fe5b04949350505050565b6060635caa0b0560e01b83836040516024016123079291906155ac565b60607f0b02d77300000000000000000000000000000000000000000000000000000000826001811115613f3c57fe5b604051602401612ae4919061580e565b613f54615199565b506000828152600e602090815260408083208484528252918290208251808401909352805483526001015490820152613f8c81614e70565b15613f9657610fcf565b6000613fa983600163ffffffff61239416565b6000858152600e60209081526040808320848452825291829020825180840190935280548352600101549082015292509050613fe482614e70565b15613fef5750610fcf565b6000848152600f60205260409020548381101561404c576000858152600e602090815260408083208484528252918290208251808401909352805483526001015490820152925061403f83614e70565b1561404c5750610fcf9050565b50506040805180820190915260008152600160208201529392505050565b600081614079575060006140ed565b8361409957614092856139cd848963ffffffff613e9516565b90506140ed565b60006140be6140ae868863ffffffff613e9516565b6124db898763ffffffff613e9516565b905060006140d2828663ffffffff613ec616565b90506140e8876139cd868463ffffffff613e9516565b925050505b95945050505050565b60008083121561410e5761410e610a18600185614f04565b600082121561412557614125610a18600184614f04565b610fcc614142846f80000000000000000000000000000000614f45565b83614f8d565b6000610fcc614142846f80000000000000000000000000000000614f45565b60006f8000000000000000000000000000000082131561418f5761418f610a1860018461500e565b600082136141a5576141a5610a1860008461500e565b6f800000000000000000000000000000008214156141c557506000610c85565b640733048c5a82136141f857507fffffffffffffffffffffffffffffffe010000000000000000000000000000000610c85565b60008060006a01c8464f761647600000008513614257577ffffffffffffffffffffffffffffffff000000000000000000000000000000000909301926a01c8464f761647600000006f8000000000000000000000000000000086020594505b6cf1aaddd7742e9000000000000085136142b5577ffffffffffffffffffffffffffffffff800000000000000000000000000000000909301926cf1aaddd7742e900000000000006f8000000000000000000000000000000086020594505b6e0afe10820813d780000000000000008513614317577ffffffffffffffffffffffffffffffffc00000000000000000000000000000000909301926e0afe10820813d780000000000000006f8000000000000000000000000000000086020594505b6f02582ab704279ec00000000000000000851361437b577ffffffffffffffffffffffffffffffffe00000000000000000000000000000000909301926f02582ab704279ec000000000000000006f8000000000000000000000000000000086020594505b6f1152aaa3bf81cc00000000000000000085136143df577fffffffffffffffffffffffffffffffff00000000000000000000000000000000909301926f1152aaa3bf81cc0000000000000000006f8000000000000000000000000000000086020594505b6f2f16ac6c59de700000000000000000008513614443577fffffffffffffffffffffffffffffffff80000000000000000000000000000000909301926f2f16ac6c59de700000000000000000006f8000000000000000000000000000000086020594505b6f4da2cbf1be582800000000000000000085136144a7577fffffffffffffffffffffffffffffffffc0000000000000000000000000000000909301926f4da2cbf1be58280000000000000000006f8000000000000000000000000000000086020594505b6f63afbe7ab2082c000000000000000000851361450b577fffffffffffffffffffffffffffffffffe0000000000000000000000000000000909301926f63afbe7ab2082c0000000000000000006f8000000000000000000000000000000086020594505b6f70f5a893b608861e1f58934f97aea57d851361456f577ffffffffffffffffffffffffffffffffff0000000000000000000000000000000909301926f70f5a893b608861e1f58934f97aea57d6f8000000000000000000000000000000086020594505b7fffffffffffffffffffffffffffffffff80000000000000000000000000000000850192508291506f80000000000000000000000000000000828002059050700100000000000000000000000000000000838103830205840193506f80000000000000000000000000000000818302816145e557fe5b059150700200000000000000000000000000000000836faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0383028161461657fe5b05840193506f800000000000000000000000000000008183028161463657fe5b059150700300000000000000000000000000000000836f999999999999999999999999999999990383028161466757fe5b05840193506f800000000000000000000000000000008183028161468757fe5b059150700400000000000000000000000000000000836f92492492492492492492492492492492038302816146b857fe5b05840193506f80000000000000000000000000000000818302816146d857fe5b059150700500000000000000000000000000000000836f8e38e38e38e38e38e38e38e38e38e38e0383028161470957fe5b05840193506f800000000000000000000000000000008183028161472957fe5b059150700600000000000000000000000000000000836f8ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b0383028161475a57fe5b05840193506f800000000000000000000000000000008183028161477a57fe5b059150700700000000000000000000000000000000836f89d89d89d89d89d89d89d89d89d89d89038302816147ab57fe5b05840193506f80000000000000000000000000000000818302816147cb57fe5b059150700800000000000000000000000000000000836f88888888888888888888888888888888038302816147fc57fe5b0584019350505050919050565b60006134296141428585614f45565b60007fffffffffffffffffffffffffffffffe01000000000000000000000000000000082121561484a57506000610c85565b8161486657506f80000000000000000000000000000000610c85565b600082131561487d5761487d610a1860018461500e565b6f800000000000000000000000000000006f1000000000000000000000000000000083078080028290056710e1b3be415a0000810293909301929091818302059050806705a0913f6b1e000002830192506f80000000000000000000000000000000828202816148e957fe5b05905080670168244fdac7800002830192506f800000000000000000000000000000008282028161491657fe5b05905080664807432bc1800002830192506f800000000000000000000000000000008282028161494257fe5b05905080660c0135dca0400002830192506f800000000000000000000000000000008282028161496e57fe5b059050806601b707b1cdc00002830192506f800000000000000000000000000000008282028161499a57fe5b059050806536e0f639b80002830192506f80000000000000000000000000000000828202816149c557fe5b05905080650618fee9f80002830192506f80000000000000000000000000000000828202816149f057fe5b05905080649c197dcc0002830192506f8000000000000000000000000000000082820281614a1a57fe5b05905080640e30dce40002830192506f8000000000000000000000000000000082820281614a4457fe5b0590508064012ebd130002830192506f8000000000000000000000000000000082820281614a6e57fe5b059050806317499f0002830192506f8000000000000000000000000000000082820281614a9757fe5b059050806301a9d48002830192506f8000000000000000000000000000000082820281614ac057fe5b05905080621c638002830192506f8000000000000000000000000000000082820281614ae857fe5b059050806201c63802830192506f8000000000000000000000000000000082820281614b1057fe5b05905080611ab802830192506f8000000000000000000000000000000082820281614b3757fe5b0590508061017c02830192506f8000000000000000000000000000000082820281614b5e57fe5b05905080601402830192506f8000000000000000000000000000000082820281614b8457fe5b600095909503946721c3677c82b400009190059384010582016f8000000000000000000000000000000001929050701000000000000000000000000000000000841615614bf3577243cbaf42a000812488fc5c220ad7b97bf6e99e6cf1aaddd7742e56d32fb9f9974484020592505b700800000000000000000000000000000000841615614c35577105d27a9f51c31b7c2f8038212a05747799916e0afe10820813d65dfe6a33c07f738f84020592505b700400000000000000000000000000000000841615614c7757701b4c902e273a58678d6d3bfdb93db96d026f02582ab704279e8efd15e0265855c47a84020592505b700200000000000000000000000000000000841615614cb9577003b1cc971a9bb5b9867477440d6d1577506f1152aaa3bf81cb9fdb76eae12d02957184020592505b700100000000000000000000000000000000841615614cfb5770015bf0a8b1457695355fb8ac404e7a79e36f2f16ac6c59de6f8d5d6f63c1482a7c8684020592505b6f80000000000000000000000000000000841615614d3b576fd3094c70f034de4b96ff7d5b6f99fcd86f4da2cbf1be5827f9eb3ad1aa9866ebb384020592505b6f40000000000000000000000000000000841615614d7b576fa45af1e1f40c333b3de1db4dd55f29a76f63afbe7ab2082ba1a0ae5e4eb1b479dc84020592505b6f20000000000000000000000000000000841615614dbb576f910b022db7ae67ce76b441c27035c6a16f70f5a893b608861e1f58934f97aea57d84020592505b6f10000000000000000000000000000000841615614dfb576f88415abbe9a76bead8d00cf112e4d4a86f783eafef1c0a8f3978c7f81824d62ebf84020592505b5050919050565b60006f80000000000000000000000000000000614e1f8484614f45565b81614e2657fe5b059392505050565b600080821215614e4657614e46610a18600184614f04565b6000614e528484614f45565b905060008113614e66576000915050610fcf565b607f1c9392505050565b60200151151590565b60008085614e8b575082905081614ed2565b83614e9a575084905083614ed2565b614ebd614ead858763ffffffff613e9516565b613acc888663ffffffff613e9516565b9150614ecf858463ffffffff613e9516565b90505b94509492505050565b600080614ef984846f8000000000000000000000000000000061503d565b915091509250929050565b60607fbd79545f00000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b8360405160240161230792919061581c565b600082614f5457506000610fcf565b5081810281838281614f6257fe5b05141580614f79575082828281614f7557fe5b0514155b15610fcf57610fcf610a18600185856150ab565b600081614fa357614fa3610a18600285856150ab565b7f800000000000000000000000000000000000000000000000000000000000000083148015614ff15750817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff145b1561500557615005610a18600385856150ab565b818381614e2657fe5b60607fed2f26a100000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b6000808285118061504d57508284115b156150a2576000848610156150625784615064565b855b9050615076818563ffffffff613ec616565b9050615088868263ffffffff613ec616565b925061509a858263ffffffff613ec616565b91505061327a565b50929391925050565b60607f8c12dfe7000000000000000000000000000000000000000000000000000000008460038111156150da57fe5b84846040516024016136679392919061582f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180606001604052806000815260200160008152602001600081525090565b604080518082019091526000808252602082015290565b8154818355818111156112fb576000838152602090206112fb9181019083016151b3565b604051806040016040528060008152602001600081525090565b610bed91905b808211156151cd57600081556001016151b9565b5090565b6000604082840312156125ca578081fd5b6000602082840312156151f3578081fd5b8135610fcc81615854565b60006020828403121561520f578081fd5b8151610fcc81615854565b60008060006060848603121561522e578182fd5b833561523981615854565b9250602084013561524981615854565b929592945050506040919091013590565b6000806040838503121561526c578182fd5b823561527781615854565b946020939093013593505050565b60008060408385031215615297578182fd5b82356152a281615854565b915060208301356152b281615884565b809150509250929050565b6000602082840312156152ce578081fd5b8151610fcc81615876565b6000602082840312156152ea578081fd5b5035919050565b60008060408385031215615303578182fd5b8235915060208301356152b281615854565b60008060408385031215615327578182fd5b50508035926020909101359150565b60008060408385031215615348578182fd5b82359150602083013563ffffffff811681146152b2578182fd5b600060208284031215615373578081fd5b8135610fcc81615884565b600080600060a08486031215615392578283fd5b61539c85856151d1565b92506153ab85604086016151d1565b9150608084013590509250925092565b6000602082840312156153cc578081fd5b5051919050565b600080600080600060a086880312156153ea578283fd5b8535945060208601356153fc81615891565b935060408601359250606086013561541381615891565b9150608086013561542381615891565b809150509295509295909350565b60008060408385031215615443578182fd5b823561544e81615891565b915060208301356152b281615876565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000918401906040840190835b8181101561554b57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101615517565b509095945050505050565b901515815260200190565b90815260200190565b92835273ffffffffffffffffffffffffffffffffffffffff91909116602083015263ffffffff16604082015260600190565b9182521515602082015260400190565b918252602082015260400190565b60608101600485106155c857fe5b938152602081019290925260409091015290565b60408101600384106155ea57fe5b9281526020015290565b604081016156018461584a565b92815273ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b606081016156338561584a565b938152602081019290925263ffffffff1660409091015290565b60208082526013908201527f43525f494e54455256414c5f494e56414c494400000000000000000000000000604082015260600190565b60208082526014908201527f574554485f5452414e534645525f4641494c4544000000000000000000000000604082015260600190565b81518152602080830151908201526040918201519181019190915260600190565b815173ffffffffffffffffffffffffffffffffffffffff16815260209182015163ffffffff169181019190915260400190565b815167ffffffffffffffff1681526020808301516bffffffffffffffffffffffff90811691830191909152604092830151169181019190915260600190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b948552602085019390935260408401919091526060830152608082015260a00190565b94855263ffffffff938416602086015260408501929092528216606084015216608082015260a00190565b92835260ff918216602084015216604082015260600190565b63ffffffff91909116815260200190565b63ffffffff92831681529116602082015260400190565b60ff91909116815260200190565b60ff929092168252602082015260400190565b60ff9390931683526020830191909152604082015260600190565b60028110610f7357fe5b73ffffffffffffffffffffffffffffffffffffffff81168114610f7357600080fd5b8015158114610f7357600080fd5b60028110610f7357600080fd5b63ffffffff81168114610f7357600080fdfea365627a7a723158204003618f6c03f1af7bc4ce4395045c4daf1b1bb0cfdb9b3a5cb30deba631ee256c6578706572696d656e74616cf564736f6c634300050c0040" + } + } + }, + "compiler": { + "name": "solc", + "version": "soljson-v0.5.12+commit.7709ece9.js", + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000, + "details": { "yul": true, "deduplicate": true, "cse": true, "constantOptimizer": true } + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode.object", + "evm.bytecode.sourceMap", + "evm.deployedBytecode.object", + "evm.deployedBytecode.sourceMap" + ] + } + }, + "evmVersion": "constantinople" + } + }, + "chains": {} +} diff --git a/packages/contract-artifacts/artifacts/ZrxVault.json b/packages/contract-artifacts/artifacts/ZrxVault.json new file mode 100644 index 0000000000..eaaf03a406 --- /dev/null +++ b/packages/contract-artifacts/artifacts/ZrxVault.json @@ -0,0 +1,296 @@ +{ + "schemaVersion": "2.0.0", + "contractName": "ZrxVault", + "compilerOutput": { + "abi": [ + { + "inputs": [ + { "internalType": "address", "name": "_zrxProxyAddress", "type": "address" }, + { "internalType": "address", "name": "_zrxTokenAddress", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "AuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "AuthorizedAddressRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "sender", "type": "address" }], + "name": "InCatastrophicFailureMode", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "stakingProxyAddress", "type": "address" } + ], + "name": "StakingProxySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "zrxProxyAddress", "type": "address" } + ], + "name": "ZrxProxySet", + "type": "event" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "authorities", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "authorized", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "staker", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceOfZrxVault", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "staker", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "depositFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "enterCatastrophicFailure", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInCatastrophicFailure", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "target", "type": "address" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "removeAuthorizedAddressAtIndex", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "_stakingProxyAddress", "type": "address" }], + "name": "setStakingProxy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "_zrxProxyAddress", "type": "address" }], + "name": "setZrxProxy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "stakingProxyAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "staker", "type": "address" }], + "name": "withdrawAllFrom", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "staker", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "withdrawFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "zrxAssetProxy", + "outputs": [{ "internalType": "contract IAssetProxy", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "object": "0x60806040523480156200001157600080fd5b506040516200190238038062001902833981810160405260408110156200003757600080fd5b508051602091820151600080546001600160a01b03199081163317909155600580546001600160a01b0380861691841691909117909155600680549184169190921681179091556040805160248082019390935281518082039093018352604401905292830180516001600160e01b03167ff47261b000000000000000000000000000000000000000000000000000000000178152925191929091620000e091600791620000e9565b5050506200018e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200012c57805160ff19168380011785556200015c565b828001600101855582156200015c579182015b828111156200015c5782518255916020019190600101906200013f565b506200016a9291506200016e565b5090565b6200018b91905b808211156200016a576000815560010162000175565b90565b611764806200019e6000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80639470b0bd116100cd578063c4d8f23711610081578063d39de6e911610066578063d39de6e9146103d1578063f2fde38b14610429578063f957ddba1461045c57610151565b8063c4d8f23714610396578063ca5b02181461039e57610151565b80639ad26744116100b25780639ad2674414610322578063b91816111461035b578063c02e5a7f1461038e57610151565b80639470b0bd146102e15780639706e0c01461031a57610151565b8063494503d4116101245780637071293911610109578063707129391461026157806370a08231146102945780638da5cb5b146102d957610151565b8063494503d4146102115780636bf3f9e51461022e57610151565b806315cc36f214610156578063266df27c1461019157806342f1181e146101ad5780634551ab31146101e0575b600080fd5b61018f6004803603604081101561016c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561048f565b005b610199610676565b604080519115158252519081900360200190f35b61018f600480360360208110156101c357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610697565b6101e86106ab565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101e86004803603602081101561022757600080fd5b50356106c7565b61018f6004803603602081101561024457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106fb565b61018f6004803603602081101561027757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661077c565b6102c7600480360360208110156102aa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610836565b60408051918252519081900360200190f35b6101e861085e565b61018f600480360360408110156102f757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561087a565b6102c7610894565b61018f6004803603604081101561033857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610937565b6101996004803603602081101561037157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610949565b61018f61095e565b6101e86109e2565b61018f600480360360208110156103b457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166109fe565b6103d9610a87565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104155781810151838201526020016103fd565b505050509050019250505060405180910390f35b61018f6004803603602081101561043f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610af6565b6102c76004803603602081101561047257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b99565b610497610bd9565b61049f610c06565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600460205260409020546104d5908263ffffffff610c3416565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604091829020939093558051848152905191927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c92918290030190a26005546040517fa85e59e400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660248301523060448301819052606483018590526080600484019081526007805460027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600183161561010002019091160460848601819052939095169463a85e59e494909388939288929091829160a40190879080156106375780601f1061060c57610100808354040283529160200191610637565b820191906000526020600020905b81548152906001019060200180831161061a57829003601f168201915b505095505050505050600060405180830381600087803b15801561065a57600080fd5b505af115801561066e573d6000803e3d6000fd5b505050505050565b60035474010000000000000000000000000000000000000000900460ff1681565b61069f610c57565b6106a881610c9e565b50565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b600281815481106106d457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b610703610dcf565b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fb72b2a9919ffd08bc0d415d8a38b1395a40377207a9867cac2e3c10b1aa560fc9181900360200190a150565b610784610c57565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166107c2576107c26107bd82610df2565b610e75565b60005b600254811015610832578173ffffffffffffffffffffffffffffffffffffffff16600282815481106107f357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561082a576108258282610e7d565b610832565b6001016107c5565b5050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b610882610bd9565b61088a610c06565b61083282826110cc565b600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561090557600080fd5b505afa158015610919573d6000803e3d6000fd5b505050506040513d602081101561092f57600080fd5b505190505b90565b61093f610c57565b6108328282610e7d565b60016020526000908152604090205460ff1681565b610966610dcf565b61096e610c06565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040805133815290517fdc2ba7cd6b8e3bf6f27f665a737e34fb7f72f480a597b51686332c539fab04489181900360200190a1565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b610a06610dcf565b610a0e610c06565b6005805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fab1ca8eb645c27b1fa85b29ed92584109de7cc576a907cddaa0bf3f1f7f253109181900360200190a150565b60606002805480602002602001604051908101604052809291908181526020018280548015610aec57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610ac1575b5050505050905090565b610afe610c57565b73ffffffffffffffffffffffffffffffffffffffff8116610b2957610b246107bd61120d565b6106a8565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000610ba3611244565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054610bd383826110cc565b92915050565b60035473ffffffffffffffffffffffffffffffffffffffff163314610c0457610c046107bd33611271565b565b60035474010000000000000000000000000000000000000000900460ff1615610c0457610c046107bd6112f4565b600082820183811015610c5057610c506107bd6000868661132b565b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c0457600054610c04906107bd90339073ffffffffffffffffffffffffffffffffffffffff166113ca565b73ffffffffffffffffffffffffffffffffffffffff8116610cc457610cc46107bd611456565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff1615610cfe57610cfe6107bd8261148d565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b3360009081526001602052604090205460ff16610c0457610c046107bd33611510565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167feb5108a200000000000000000000000000000000000000000000000000000000179052919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610eb657610eb66107bd83610df2565b6002548110610ed157610ed16107bd82600280549050611593565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110610ef557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610f5757610f576107bd60028381548110610f2f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684611606565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610fd257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061100557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061108490826116e8565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054611102908263ffffffff61169216565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604091829020939093558051848152905191927f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436492918290030190a2600654604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b505050506040513d602081101561120757600080fd5b50505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b60035474010000000000000000000000000000000000000000900460ff16610c0457610c046107bd6116b1565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fca1d07a200000000000000000000000000000000000000000000000000000000179052919050565b60408051808201909152600481527f7dd020ce00000000000000000000000000000000000000000000000000000000602082015290565b606063e946c1bb60e01b8484846040516024018084600381111561134b57fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1de45ad10000000000000000000000000000000000000000000000000000000017905292915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fde16f1a000000000000000000000000000000000000000000000000000000000179052919050565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fb65a25b900000000000000000000000000000000000000000000000000000000179052919050565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe9f837710000000000000000000000000000000000000000000000000000000017905292915050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f140a84db0000000000000000000000000000000000000000000000000000000017905292915050565b6000828211156116ab576116ab6107bd6002858561132b565b50900390565b60408051808201909152600481527f3ef081cc00000000000000000000000000000000000000000000000000000000602082015290565b81548183558181111561170c5760008381526020902061170c918101908301611711565b505050565b61093491905b8082111561172b5760008155600101611717565b509056fea265627a7a7231582076aa219cd66c1764c8a7c96df5b96bdd788590bf2a082860417fc45b656de06664736f6c634300050c0032" + }, + "deployedBytecode": { + "object": "0x608060405234801561001057600080fd5b50600436106101515760003560e01c80639470b0bd116100cd578063c4d8f23711610081578063d39de6e911610066578063d39de6e9146103d1578063f2fde38b14610429578063f957ddba1461045c57610151565b8063c4d8f23714610396578063ca5b02181461039e57610151565b80639ad26744116100b25780639ad2674414610322578063b91816111461035b578063c02e5a7f1461038e57610151565b80639470b0bd146102e15780639706e0c01461031a57610151565b8063494503d4116101245780637071293911610109578063707129391461026157806370a08231146102945780638da5cb5b146102d957610151565b8063494503d4146102115780636bf3f9e51461022e57610151565b806315cc36f214610156578063266df27c1461019157806342f1181e146101ad5780634551ab31146101e0575b600080fd5b61018f6004803603604081101561016c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561048f565b005b610199610676565b604080519115158252519081900360200190f35b61018f600480360360208110156101c357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610697565b6101e86106ab565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101e86004803603602081101561022757600080fd5b50356106c7565b61018f6004803603602081101561024457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106fb565b61018f6004803603602081101561027757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661077c565b6102c7600480360360208110156102aa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610836565b60408051918252519081900360200190f35b6101e861085e565b61018f600480360360408110156102f757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561087a565b6102c7610894565b61018f6004803603604081101561033857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610937565b6101996004803603602081101561037157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610949565b61018f61095e565b6101e86109e2565b61018f600480360360208110156103b457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166109fe565b6103d9610a87565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104155781810151838201526020016103fd565b505050509050019250505060405180910390f35b61018f6004803603602081101561043f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610af6565b6102c76004803603602081101561047257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b99565b610497610bd9565b61049f610c06565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600460205260409020546104d5908263ffffffff610c3416565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604091829020939093558051848152905191927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c92918290030190a26005546040517fa85e59e400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660248301523060448301819052606483018590526080600484019081526007805460027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600183161561010002019091160460848601819052939095169463a85e59e494909388939288929091829160a40190879080156106375780601f1061060c57610100808354040283529160200191610637565b820191906000526020600020905b81548152906001019060200180831161061a57829003601f168201915b505095505050505050600060405180830381600087803b15801561065a57600080fd5b505af115801561066e573d6000803e3d6000fd5b505050505050565b60035474010000000000000000000000000000000000000000900460ff1681565b61069f610c57565b6106a881610c9e565b50565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b600281815481106106d457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b610703610dcf565b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fb72b2a9919ffd08bc0d415d8a38b1395a40377207a9867cac2e3c10b1aa560fc9181900360200190a150565b610784610c57565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166107c2576107c26107bd82610df2565b610e75565b60005b600254811015610832578173ffffffffffffffffffffffffffffffffffffffff16600282815481106107f357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561082a576108258282610e7d565b610832565b6001016107c5565b5050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b610882610bd9565b61088a610c06565b61083282826110cc565b600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561090557600080fd5b505afa158015610919573d6000803e3d6000fd5b505050506040513d602081101561092f57600080fd5b505190505b90565b61093f610c57565b6108328282610e7d565b60016020526000908152604090205460ff1681565b610966610dcf565b61096e610c06565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040805133815290517fdc2ba7cd6b8e3bf6f27f665a737e34fb7f72f480a597b51686332c539fab04489181900360200190a1565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b610a06610dcf565b610a0e610c06565b6005805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fab1ca8eb645c27b1fa85b29ed92584109de7cc576a907cddaa0bf3f1f7f253109181900360200190a150565b60606002805480602002602001604051908101604052809291908181526020018280548015610aec57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610ac1575b5050505050905090565b610afe610c57565b73ffffffffffffffffffffffffffffffffffffffff8116610b2957610b246107bd61120d565b6106a8565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000610ba3611244565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054610bd383826110cc565b92915050565b60035473ffffffffffffffffffffffffffffffffffffffff163314610c0457610c046107bd33611271565b565b60035474010000000000000000000000000000000000000000900460ff1615610c0457610c046107bd6112f4565b600082820183811015610c5057610c506107bd6000868661132b565b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c0457600054610c04906107bd90339073ffffffffffffffffffffffffffffffffffffffff166113ca565b73ffffffffffffffffffffffffffffffffffffffff8116610cc457610cc46107bd611456565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff1615610cfe57610cfe6107bd8261148d565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b3360009081526001602052604090205460ff16610c0457610c046107bd33611510565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167feb5108a200000000000000000000000000000000000000000000000000000000179052919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610eb657610eb66107bd83610df2565b6002548110610ed157610ed16107bd82600280549050611593565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110610ef557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610f5757610f576107bd60028381548110610f2f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684611606565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610fd257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061100557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061108490826116e8565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054611102908263ffffffff61169216565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604091829020939093558051848152905191927f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436492918290030190a2600654604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b505050506040513d602081101561120757600080fd5b50505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b60035474010000000000000000000000000000000000000000900460ff16610c0457610c046107bd6116b1565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fca1d07a200000000000000000000000000000000000000000000000000000000179052919050565b60408051808201909152600481527f7dd020ce00000000000000000000000000000000000000000000000000000000602082015290565b606063e946c1bb60e01b8484846040516024018084600381111561134b57fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1de45ad10000000000000000000000000000000000000000000000000000000017905292915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fde16f1a000000000000000000000000000000000000000000000000000000000179052919050565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fb65a25b900000000000000000000000000000000000000000000000000000000179052919050565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe9f837710000000000000000000000000000000000000000000000000000000017905292915050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f140a84db0000000000000000000000000000000000000000000000000000000017905292915050565b6000828211156116ab576116ab6107bd6002858561132b565b50900390565b60408051808201909152600481527f3ef081cc00000000000000000000000000000000000000000000000000000000602082015290565b81548183558181111561170c5760008381526020902061170c918101908301611711565b505050565b61093491905b8082111561172b5760008155600101611717565b509056fea265627a7a7231582076aa219cd66c1764c8a7c96df5b96bdd788590bf2a082860417fc45b656de06664736f6c634300050c0032" + } + } + }, + "compiler": { + "name": "solc", + "version": "soljson-v0.5.12+commit.7709ece9.js", + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000, + "details": { "yul": true, "deduplicate": true, "cse": true, "constantOptimizer": true } + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode.object", + "evm.bytecode.sourceMap", + "evm.deployedBytecode.object", + "evm.deployedBytecode.sourceMap" + ] + } + }, + "evmVersion": "constantinople" + } + }, + "chains": {} +} diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts index 45ade678de..d50a9c0ea3 100644 --- a/packages/contract-artifacts/src/index.ts +++ b/packages/contract-artifacts/src/index.ts @@ -1,27 +1,41 @@ -import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json'; import * as Coordinator from '../artifacts/Coordinator.json'; import * as CoordinatorRegistry from '../artifacts/CoordinatorRegistry.json'; import * as DevUtils from '../artifacts/DevUtils.json'; -import * as DummyERC20Token from '../artifacts/DummyERC20Token.json'; -import * as DummyERC721Token from '../artifacts/DummyERC721Token.json'; -import * as DutchAuction from '../artifacts/DutchAuction.json'; -import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json'; -import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json'; -import * as ERC20Proxy from '../artifacts/ERC20Proxy.json'; -import * as ERC20Token from '../artifacts/ERC20Token.json'; -import * as ERC721Proxy from '../artifacts/ERC721Proxy.json'; -import * as ERC721Token from '../artifacts/ERC721Token.json'; import * as Exchange from '../artifacts/Exchange.json'; import * as Forwarder from '../artifacts/Forwarder.json'; -import * as IAssetProxy from '../artifacts/IAssetProxy.json'; + +import * as Staking from '../artifacts/Staking.json'; +import * as WETH9 from '../artifacts/WETH9.json'; + +// Order Utils import * as IValidator from '../artifacts/IValidator.json'; import * as IWallet from '../artifacts/IWallet.json'; -import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json'; -import * as OrderValidator from '../artifacts/OrderValidator.json'; -import * as Staking from '../artifacts/Staking.json'; + +// Tokens (allowances, transfers, events) +import * as ERC20Token from '../artifacts/ERC20Token.json'; +import * as ERC721Token from '../artifacts/ERC721Token.json'; + +// Migrations Testnet/Ganache +import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json'; +import * as DummyERC20Token from '../artifacts/DummyERC20Token.json'; +import * as DummyERC721Token from '../artifacts/DummyERC721Token.json'; +import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json'; import * as StakingProxy from '../artifacts/StakingProxy.json'; +import * as TestStaking from '../artifacts/TestStaking.json'; +import * as ZrxVault from '../artifacts/ZrxVault.json'; + +// Proxies (Migrations) +import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json'; +import * as ERC20BridgeProxy from '../artifacts/ERC20BridgeProxy.json'; +import * as ERC20Proxy from '../artifacts/ERC20Proxy.json'; +import * as ERC721Proxy from '../artifacts/ERC721Proxy.json'; +import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json'; import * as StaticCallProxy from '../artifacts/StaticCallProxy.json'; -import * as WETH9 from '../artifacts/WETH9.json'; + +// Unknown/Unused +import * as DutchAuction from '../artifacts/DutchAuction.json'; +import * as IAssetProxy from '../artifacts/IAssetProxy.json'; +import * as OrderValidator from '../artifacts/OrderValidator.json'; import * as ZRXToken from '../artifacts/ZRXToken.json'; export { @@ -32,6 +46,7 @@ export { DummyERC721Token, ERC1155Mintable, ERC1155Proxy, + ERC20BridgeProxy, ERC20Proxy, ERC20Token, ERC721Proxy, @@ -50,4 +65,6 @@ export { CoordinatorRegistry, Staking, StakingProxy, + TestStaking, + ZrxVault, }; diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json index 9d815d9b96..a8e7b480d1 100644 --- a/packages/contract-artifacts/tsconfig.json +++ b/packages/contract-artifacts/tsconfig.json @@ -31,6 +31,9 @@ "./artifacts/ERC1155Proxy.json", "./artifacts/StaticCallProxy.json", "./artifacts/Staking.json", - "./artifacts/StakingProxy.json" + "./artifacts/StakingProxy.json", + "./artifacts/TestStaking.json", + "./artifacts/ZrxVault.json", + "./artifacts/ERC20BridgeProxy.json" ] } diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index a2247ffc29..715cf823a9 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -1,4 +1,4 @@ -import { CoordinatorContract, OrderValidatorContract } from '@0x/abi-gen-wrappers'; +import { CoordinatorContract, OrderValidatorContract, ZrxVaultContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; import * as artifacts from '@0x/contract-artifacts'; import { @@ -7,6 +7,7 @@ import { ERC721ProxyContract, MultiAssetProxyContract, StaticCallProxyContract, + ERC20BridgeProxyContract, } from '@0x/contracts-asset-proxy'; import { CoordinatorRegistryContract } from '@0x/contracts-coordinator'; import { DevUtilsContract } from '@0x/contracts-dev-utils'; @@ -19,10 +20,10 @@ import { Web3ProviderEngine } from '@0x/subproviders'; import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types'; -import * as _ from 'lodash'; import { constants } from './utils/constants'; import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info'; +import { TestStakingContract, StakingProxyContract } from '@0x/contracts-staking'; // HACK (xianny): Copied from @0x/order-utils to get rid of circular dependency /** @@ -83,11 +84,15 @@ export async function runMigrationsAsync( ); // ZRX - const zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync( - artifacts.ZRXToken, + const zrxToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync( + artifacts.DummyERC20Token, provider, txDefaults, artifacts, + '0x Protocol Token', + 'ZRX', + new BigNumber(18), + new BigNumber(1000000000000000000000000000), ); // Ether token @@ -184,28 +189,6 @@ export async function runMigrationsAsync( encodeERC20AssetData(etherToken.address), ); - // TODO(fabio): Remove orderValidator after @0x/asset-buyer is deleted - // OrderValidator - const orderValidator = await OrderValidatorContract.deployFrom0xArtifactAsync( - artifacts.OrderValidator, - provider, - txDefaults, - artifacts, - exchange.address, - zrxAssetData, - ); - - // TODO(fabio): Uncomment dutchAuction once the @0x/contracts-extensions is refactored - // for V3 - // // DutchAuction - // const dutchAuction = await DutchAuctionContract.deployFrom0xArtifactAsync( - // artifacts.DutchAuction, - // provider, - // txDefaults, - // artifacts, - // exchange.address, - // ); - // TODO (xianny): figure out how to deploy AssetProxyOwnerContract properly // // Multisigs // const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync(); @@ -244,16 +227,11 @@ export async function runMigrationsAsync( // Fake the above transactions so our nonce increases and we result with the same addresses // while AssetProxyOwner is disabled (TODO: @dekz remove) - const dummyTransactionCount = 6; + const dummyTransactionCount = 8; for (let index = 0; index < dummyTransactionCount; index++) { await web3Wrapper.sendTransactionAsync({ to: txDefaults.from, from: txDefaults.from, value: new BigNumber(0) }); } - // Fund the Forwarder with ZRX - const zrxDecimals = await zrxToken.decimals().callAsync(); - const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals); - await zrxToken.transfer(forwarder.address, zrxForwarderAmount).awaitTransactionSuccessAsync(txDefaults); - // CoordinatorRegistry const coordinatorRegistry = await CoordinatorRegistryContract.deployFrom0xArtifactAsync( artifacts.CoordinatorRegistry, @@ -288,6 +266,59 @@ export async function runMigrationsAsync( artifacts, ); + const erc20BridgeProxy = await ERC20BridgeProxyContract.deployFrom0xArtifactAsync( + artifacts.ERC20BridgeProxy, + provider, + txDefaults, + {}, + ); + await exchange.registerAssetProxy(erc20BridgeProxy.address).awaitTransactionSuccessAsync(txDefaults); + await erc20BridgeProxy.addAuthorizedAddress(exchange.address).awaitTransactionSuccessAsync(txDefaults); + await erc20BridgeProxy.addAuthorizedAddress(multiAssetProxy.address).awaitTransactionSuccessAsync(txDefaults); + await multiAssetProxy.registerAssetProxy(erc20BridgeProxy.address).awaitTransactionSuccessAsync(txDefaults); + + const zrxProxy = erc20Proxy.address; + const zrxVault = await ZrxVaultContract.deployFrom0xArtifactAsync( + artifacts.ZrxVault, + provider, + txDefaults, + {}, + zrxProxy, + zrxToken.address, + ); + await erc20Proxy.addAuthorizedAddress(zrxVault.address).awaitTransactionSuccessAsync(txDefaults); + + // Note we use TestStakingContract as the deployed bytecode of a StakingContract + // has the tokens hardcoded + const stakingLogic = await TestStakingContract.deployFrom0xArtifactAsync( + artifacts.Staking, + provider, + txDefaults, + {}, + etherToken.address, + zrxVault.address, + ); + + const stakingProxy = await StakingProxyContract.deployFrom0xArtifactAsync( + artifacts.StakingProxy, + provider, + txDefaults, + {}, + stakingLogic.address, + ); + + // Reference the Proxy as the StakingContract for setup + const stakingDel = await new TestStakingContract(stakingProxy.address, provider, txDefaults); + await stakingProxy.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults); + await stakingDel.addExchangeAddress(exchange.address).awaitTransactionSuccessAsync(txDefaults); + await exchange.setProtocolFeeCollectorAddress(stakingProxy.address).awaitTransactionSuccessAsync(txDefaults); + await exchange.setProtocolFeeMultiplier(new BigNumber(150000)).awaitTransactionSuccessAsync(txDefaults); + + await zrxVault.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults); + await zrxVault.setStakingProxy(stakingProxy.address).awaitTransactionSuccessAsync(txDefaults); + await stakingLogic.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults); + await stakingLogic.addExchangeAddress(exchange.address).awaitTransactionSuccessAsync(txDefaults); + const contractAddresses = { erc20Proxy: erc20Proxy.address, erc721Proxy: erc721Proxy.address, @@ -297,10 +328,10 @@ export async function runMigrationsAsync( exchange: exchange.address, // TODO (xianny): figure out how to deploy AssetProxyOwnerContract assetProxyOwner: constants.NULL_ADDRESS, - erc20BridgeProxy: constants.NULL_ADDRESS, + erc20BridgeProxy: erc20BridgeProxy.address, zeroExGovernor: constants.NULL_ADDRESS, forwarder: forwarder.address, - orderValidator: orderValidator.address, + orderValidator: constants.NULL_ADDRESS, dutchAuction: constants.NULL_ADDRESS, coordinatorRegistry: coordinatorRegistry.address, coordinator: coordinator.address, @@ -308,10 +339,9 @@ export async function runMigrationsAsync( staticCallProxy: staticCallProxy.address, devUtils: devUtils.address, exchangeV2: constants.NULL_ADDRESS, - zrxVault: constants.NULL_ADDRESS, - readOnlyProxy: constants.NULL_ADDRESS, - staking: constants.NULL_ADDRESS, - stakingProxy: constants.NULL_ADDRESS, + zrxVault: zrxVault.address, + staking: stakingLogic.address, + stakingProxy: stakingProxy.address, }; return contractAddresses; diff --git a/packages/migrations/src/utils/token_info.ts b/packages/migrations/src/utils/token_info.ts index e99e10ac65..040cb57fa0 100644 --- a/packages/migrations/src/utils/token_info.ts +++ b/packages/migrations/src/utils/token_info.ts @@ -25,8 +25,8 @@ export const erc20TokenInfo: ERC20Token[] = [ swarmHash: NULL_BYTES, }, { - name: 'Digix DAO Token', - symbol: 'DGD', + name: 'Dai', + symbol: 'DAI', decimals: new BigNumber(18), ipfsHash: NULL_BYTES, swarmHash: NULL_BYTES, From 724085e0680cf1583c50bb5889af90c225cb92e3 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Thu, 7 Nov 2019 23:25:33 +1100 Subject: [PATCH 3/3] Remove TestStaking CHANGELOG updates Rebase and clean imports Fix lint --- packages/abi-gen-wrappers/package.json | 2 +- .../generated-wrappers/erc20_bridge_proxy.ts | 1667 ----- .../src/generated-wrappers/staking.ts | 34 +- .../src/generated-wrappers/test_staking.ts | 6585 ----------------- .../src/generated-wrappers/zrx_vault.ts | 2719 ------- packages/abi-gen-wrappers/src/index.ts | 24 - packages/contract-addresses/addresses.json | 6 +- packages/contract-artifacts/CHANGELOG.json | 4 + .../artifacts/TestStaking.json | 844 --- .../artifacts/ZrxVault.json | 76 + packages/contract-artifacts/src/index.ts | 49 +- packages/contract-artifacts/tsconfig.json | 1 - packages/migrations/CHANGELOG.json | 4 + packages/migrations/src/migration.ts | 47 +- 14 files changed, 113 insertions(+), 11949 deletions(-) delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts delete mode 100644 packages/contract-artifacts/artifacts/TestStaking.json diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json index fc09011903..b265bbcba6 100644 --- a/packages/abi-gen-wrappers/package.json +++ b/packages/abi-gen-wrappers/package.json @@ -21,7 +21,7 @@ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output src/generated-wrappers --backend ethers" }, "config": { - "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DevUtils|DutchAuction|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker|ERC1155Proxy|StaticCallProxy|Staking|StakingProxy|TestStaking|ZrxVault|ERC20BridgeProxy).json" + "abis": "../contract-artifacts/artifacts/@(DevUtils|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Token|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|Coordinator|CoordinatorRegistry|Staking|StakingProxy).json" }, "repository": { "type": "git", diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts deleted file mode 100644 index b7101db3bd..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts +++ /dev/null @@ -1,1667 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { BaseContract, SubscriptionManager, PromiseWithTransactionHash } from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { - AwaitTransactionSuccessOpts, - EventCallback, - IndexedFilterValues, - SendTransactionOpts, - SimpleContractArtifact, -} from '@0x/types'; -import { Web3Wrapper } from '@0x/web3-wrapper'; -import { assert } from '@0x/assert'; -import * as ethers from 'ethers'; -// tslint:enable:no-unused-variable - -export type ERC20BridgeProxyEventArgs = - | ERC20BridgeProxyAuthorizedAddressAddedEventArgs - | ERC20BridgeProxyAuthorizedAddressRemovedEventArgs - | ERC20BridgeProxyOwnershipTransferredEventArgs; - -export enum ERC20BridgeProxyEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', - OwnershipTransferred = 'OwnershipTransferred', -} - -export interface ERC20BridgeProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface ERC20BridgeProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface ERC20BridgeProxyOwnershipTransferredEventArgs extends DecodedLogArgs { - previousOwner: string; - newOwner: string; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ERC20BridgeProxyContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode = - '0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063a85e59e411610081578063d39de6e91161005b578063d39de6e914610182578063f2fde38b14610197578063fc124ebd146101aa576100c9565b8063a85e59e41461013a578063ae25532e1461014d578063b918161114610162576100c9565b806370712939116100b2578063707129391461010c5780638da5cb5b1461011f5780639ad2674414610127576100c9565b806342f1181e146100ce578063494503d4146100e3575b600080fd5b6100e16100dc366004610f27565b6101ca565b005b6100f66100f1366004611160565b6101de565b6040516101039190611190565b60405180910390f35b6100e161011a366004610f27565b610212565b6100f66102cc565b6100e1610135366004611032565b6102e8565b6100e16101483660046110f2565b6102fa565b6101556104f6565b60405161010391906112c5565b610175610170366004610f27565b61051b565b60405161010391906112ba565b61018a610530565b6040516101039190611261565b6100e16101a5366004610f27565b61059f565b6101bd6101b836600461109d565b610642565b6040516101039190611390565b6101d26106bc565b6101db81610705565b50565b600281815481106101eb57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61021a6106bc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166102585761025861025382610836565b6108d5565b60005b6002548110156102c8578173ffffffffffffffffffffffffffffffffffffffff166002828154811061028957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156102c0576102bb82826108dd565b6102c8565b60010161025b565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6102f06106bc565b6102c882826108dd565b610302610b2c565b60008060606103566004898990508a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516103699190810190610f5f565b925092509250600061037b8487610b8d565b905060008373ffffffffffffffffffffffffffffffffffffffff1663c2df82e6868a8a8a886040518663ffffffff1660e01b81526004016103c09594939291906111d8565b602060405180830381600087803b1580156103da57600080fd5b505af11580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610412919081019061105d565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167fdc1600f30000000000000000000000000000000000000000000000000000000014610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611322565b60405180910390fd5b6104a28588610b8d565b6104b2838863ffffffff610c3916565b11156104ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611359565b50505050505050505050565b7fdc1600f3000000000000000000000000000000000000000000000000000000005b90565b60016020526000908152604090205460ff1681565b6060600280548060200260200160405190810160405280929190818152602001828054801561059557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161056a575b5050505050905090565b6105a76106bc565b73ffffffffffffffffffffffffffffffffffffffff81166105d2576105cd610253610c55565b6101db565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60008061069460048686905087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff610b4f169050565b8060200190516106a79190810190610f43565b90506106b38184610b8d565b95945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610703576000546107039061025390339073ffffffffffffffffffffffffffffffffffffffff16610c8c565b565b73ffffffffffffffffffffffffffffffffffffffff811661072b5761072b610253610d2e565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156107655761076561025382610d65565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b606063eb5108a260e01b826040516024016108519190611190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff166109165761091661025383610836565b60025481106109315761093161025382600280549050610d80565b8173ffffffffffffffffffffffffffffffffffffffff166002828154811061095557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16146109b7576109b76102536002838154811061098f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684610d9d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610a3257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610a6557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610ae49082610e99565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b3360009081526001602052604090205460ff166107035761070361025333610dba565b606081831115610b6857610b6861025360008585610dd5565b8351821115610b8157610b816102536001848751610dd5565b50819003910190815290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610be2908590600401611190565b60206040518083038186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c329190810190611178565b9392505050565b600082820183811015610c3257610c3261025360008686610e7a565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b6060631de45ad160e01b8383604051602401610ca99291906111b1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b826040516024016108519190611190565b606063e9f8377160e01b8383604051602401610ca9929190611399565b606063140a84db60e01b8383604051602401610ca99291906111b1565b606063b65a25b960e01b826040516024016108519190611190565b6060632800659560e01b848484604051602401610df493929190611314565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063e946c1bb60e01b848484604051602401610df4939291906112f2565b815481835581811115610ebd57600083815260209020610ebd918101908301610ec2565b505050565b61051891905b80821115610edc5760008155600101610ec8565b5090565b60008083601f840112610ef1578182fd5b50813567ffffffffffffffff811115610f08578182fd5b602083019150836020828501011115610f2057600080fd5b9250929050565b600060208284031215610f38578081fd5b8135610c32816113fe565b600060208284031215610f54578081fd5b8151610c32816113fe565b600080600060608486031215610f73578182fd5b8351610f7e816113fe565b6020850151909350610f8f816113fe565b604085015190925067ffffffffffffffff80821115610fac578283fd5b81860187601f820112610fbd578384fd5b8051925081831115610fcd578384fd5b610ffe60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116016113a7565b9150828252876020848301011115611014578384fd5b6110258360208401602084016113ce565b5080925050509250925092565b60008060408385031215611044578182fd5b823561104f816113fe565b946020939093013593505050565b60006020828403121561106e578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c32578182fd5b6000806000604084860312156110b1578283fd5b833567ffffffffffffffff8111156110c7578384fd5b6110d386828701610ee0565b90945092505060208401356110e7816113fe565b809150509250925092565b600080600080600060808688031215611109578081fd5b853567ffffffffffffffff81111561111f578182fd5b61112b88828901610ee0565b909650945050602086013561113f816113fe565b9250604086013561114f816113fe565b949793965091946060013592915050565b600060208284031215611171578081fd5b5035919050565b600060208284031215611189578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015280861660408401525083606083015260a0608083015282518060a084015261122b8160c08501602087016113ce565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160c0019695505050505050565b602080825282518282018190526000918401906040840190835b818110156112af57835173ffffffffffffffffffffffffffffffffffffffff1683526020938401939092019160010161127b565b509095945050505050565b901515815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b606081016004851061130057fe5b938152602081019290925260409091015290565b606081016008851061130057fe5b6020808252600d908201527f4252494447455f4641494c454400000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f4252494447455f554e4445525041590000000000000000000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156113c657600080fd5b604052919050565b60005b838110156113e95781810151838201526020016113d1565b838111156113f8576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff811681146101db57600080fdfea365627a7a723158208443fe55d18b7dc9cff24ff524db866409ee96cb967c5e055d122b01700b898d6c6578706572696d656e74616cf564736f6c634300050c0040'; - /** - * Authorizes an address. - */ - public addAuthorizedAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param target Address to authorize. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param target Address to authorize. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param target Address to authorize. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param target Address to authorize. - */ - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('target', target); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param target Address to authorize. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string): string { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public authorities = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isBigNumber('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorized = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - /** - * Retrieves the balance of `owner` for this asset. - */ - public balanceOf = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @returns balance The balance of the ERC20 token being transferred by this asset proxy. - */ - async callAsync( - assetData: string, - owner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('assetData', assetData); - assert.isString('owner', owner); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('balanceOf(bytes,address)', [ - assetData, - owner.toLowerCase(), - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('balanceOf(bytes,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - /** - * Gets all authorized addresses. - */ - public getAuthorizedAddresses = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @returns Array of authorized addresses. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - /** - * Gets the proxy id associated with this asset proxy. - */ - public getProxyId = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @returns proxyId The proxy id. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('getProxyId()', []); - const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex'); - - let rawCallResult; - try { - rawCallResult = await self._evmExecAsync(encodedDataBytes); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('owner()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - /** - * Removes authorizion of an address. - */ - public removeAuthorizedAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param target Address to remove authorization from. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param target Address to remove authorization from. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param target Address to remove authorization from. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param target Address to remove authorization from. - */ - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('target', target); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param target Address to remove authorization from. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string): string { - assert.isString('target', target); - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - /** - * Removes authorizion of an address. - */ - public removeAuthorizedAddressAtIndex = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param target Address to remove authorization from. - * @param index Index of target in authorities array. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param target Address to remove authorization from. - * @param index Index of target in authorities array. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - index: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20BridgeProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param target Address to remove authorization from. - * @param index Index of target in authorities array. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param target Address to remove authorization from. - * @param index Index of target in authorities array. - */ - async callAsync( - target: string, - index: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param target Address to remove authorization from. - * @param index Index of target in authorities array. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string, index: BigNumber): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - /** - * Calls a bridge contract to transfer `amount` of ERC20 from `from` - * to `to`. Asserts that the balance of `to` has increased by `amount`. - */ - public transferFrom = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param assetData Abi-encoded data for this asset proxy encoded as: - * abi.encodeWithSelector( bytes4 PROXY_ID, address - * tokenAddress, address bridgeAddress, bytes - * bridgeData ) - * @param from Address to transfer asset from. - * @param to Address to transfer asset to. - * @param amount Amount of asset to transfer. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.transferFrom.callAsync(assetData, from, to, amount, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param assetData Abi-encoded data for this asset proxy encoded as: - * abi.encodeWithSelector( bytes4 PROXY_ID, address - * tokenAddress, address bridgeAddress, bytes - * bridgeData ) - * @param from Address to transfer asset from. - * @param to Address to transfer asset to. - * @param amount Amount of asset to transfer. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as ERC20BridgeProxyContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param assetData Abi-encoded data for this asset proxy encoded as: - * abi.encodeWithSelector( bytes4 PROXY_ID, address - * tokenAddress, address bridgeAddress, bytes - * bridgeData ) - * @param from Address to transfer asset from. - * @param to Address to transfer asset to. - * @param amount Amount of asset to transfer. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param assetData Abi-encoded data for this asset proxy encoded as: - * abi.encodeWithSelector( bytes4 PROXY_ID, address - * tokenAddress, address bridgeAddress, bytes - * bridgeData ) - * @param from Address to transfer asset from. - * @param to Address to transfer asset to. - * @param amount Amount of asset to transfer. - */ - async callAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetData Abi-encoded data for this asset proxy encoded as: - * abi.encodeWithSelector( bytes4 PROXY_ID, address - * tokenAddress, address bridgeAddress, bytes - * bridgeData ) - * @param from Address to transfer asset from. - * @param to Address to transfer asset to. - * @param amount Amount of asset to transfer. - * @returns The ABI encoded transaction data as a 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 ERC20BridgeProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'transferFrom(bytes,address,address,uint256)', - [assetData, from.toLowerCase(), to.toLowerCase(), amount], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - public transferOwnership = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - newOwner: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20BridgeProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('newOwner', newOwner); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ERC20BridgeProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(newOwner: string): string { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ERC20BridgeProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - return abiEncoder.getSelector(); - }, - }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - ): Promise { - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (artifact.compilerOutput === undefined) { - throw new Error('Compiler output not found in the artifact file'); - } - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; - if (Object.keys(logDecodeDependencies) !== undefined) { - for (const key of Object.keys(logDecodeDependencies)) { - logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; - } - } - return ERC20BridgeProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - ): Promise { - assert.isHexString('bytecode', bytecode); - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ERC20BridgeProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20BridgeProxyContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = []; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - anonymous: false, - inputs: [ - { - name: 'target', - type: 'address', - indexed: true, - }, - { - name: 'caller', - type: 'address', - indexed: true, - }, - ], - name: 'AuthorizedAddressAdded', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'target', - type: 'address', - indexed: true, - }, - { - name: 'caller', - type: 'address', - indexed: true, - }, - ], - name: 'AuthorizedAddressRemoved', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'previousOwner', - type: 'address', - indexed: true, - }, - { - name: 'newOwner', - type: 'address', - indexed: true, - }, - ], - name: 'OwnershipTransferred', - outputs: [], - type: 'event', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - ], - name: 'addAuthorizedAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'uint256', - }, - ], - name: 'authorities', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'address', - }, - ], - name: 'authorized', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'assetData', - type: 'bytes', - }, - { - name: 'owner', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getAuthorizedAddresses', - outputs: [ - { - name: '', - type: 'address[]', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getProxyId', - outputs: [ - { - name: 'proxyId', - type: 'bytes4', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'owner', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - ], - name: 'removeAuthorizedAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - { - name: 'index', - type: 'uint256', - }, - ], - name: 'removeAuthorizedAddressAtIndex', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'assetData', - type: 'bytes', - }, - { - name: 'from', - type: 'address', - }, - { - name: 'to', - type: 'address', - }, - { - name: 'amount', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - /** - * Subscribe to an event type emitted by the ERC20BridgeProxy contract. - * @param eventName The ERC20BridgeProxy contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: ERC20BridgeProxyEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, ERC20BridgeProxyEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - ERC20BridgeProxyContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The ERC20BridgeProxy contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: ERC20BridgeProxyEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, ERC20BridgeProxyEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - ERC20BridgeProxyContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = ERC20BridgeProxyContract.deployedBytecode, - ) { - super( - 'ERC20BridgeProxy', - ERC20BridgeProxyContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - ERC20BridgeProxyContract.ABI(), - this._web3Wrapper, - ); - } -} - -// tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align -// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts b/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts index 74c0635907..429b09f520 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts @@ -262,11 +262,11 @@ export class StakingContract extends BaseContract { { inputs: [ { - name: 'wethAddress', + name: 'wethAddress_', type: 'address', }, { - name: 'zrxVaultAddress', + name: 'zrxVaultAddress_', type: 'address', }, ], @@ -1195,7 +1195,7 @@ export class StakingContract extends BaseContract { name: 'getWethContract', outputs: [ { - name: '', + name: 'wethContract', type: 'address', }, ], @@ -1533,34 +1533,6 @@ export class StakingContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { - constant: true, - inputs: [], - name: 'testWethAddress', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'testZrxVaultAddress', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, { constant: false, inputs: [ diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts b/packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts deleted file mode 100644 index cbd649ee5f..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts +++ /dev/null @@ -1,6585 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { BaseContract, SubscriptionManager, PromiseWithTransactionHash } from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { - AwaitTransactionSuccessOpts, - EventCallback, - IndexedFilterValues, - SendTransactionOpts, - SimpleContractArtifact, -} from '@0x/types'; -import { Web3Wrapper } from '@0x/web3-wrapper'; -import { assert } from '@0x/assert'; -import * as ethers from 'ethers'; -// tslint:enable:no-unused-variable - -export type TestStakingEventArgs = - | TestStakingAuthorizedAddressAddedEventArgs - | TestStakingAuthorizedAddressRemovedEventArgs - | TestStakingEpochEndedEventArgs - | TestStakingEpochFinalizedEventArgs - | TestStakingExchangeAddedEventArgs - | TestStakingExchangeRemovedEventArgs - | TestStakingMakerStakingPoolSetEventArgs - | TestStakingMoveStakeEventArgs - | TestStakingOperatorShareDecreasedEventArgs - | TestStakingOwnershipTransferredEventArgs - | TestStakingParamsSetEventArgs - | TestStakingRewardsPaidEventArgs - | TestStakingStakeEventArgs - | TestStakingStakingPoolCreatedEventArgs - | TestStakingStakingPoolEarnedRewardsInEpochEventArgs - | TestStakingUnstakeEventArgs; - -export enum TestStakingEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', - EpochEnded = 'EpochEnded', - EpochFinalized = 'EpochFinalized', - ExchangeAdded = 'ExchangeAdded', - ExchangeRemoved = 'ExchangeRemoved', - MakerStakingPoolSet = 'MakerStakingPoolSet', - MoveStake = 'MoveStake', - OperatorShareDecreased = 'OperatorShareDecreased', - OwnershipTransferred = 'OwnershipTransferred', - ParamsSet = 'ParamsSet', - RewardsPaid = 'RewardsPaid', - Stake = 'Stake', - StakingPoolCreated = 'StakingPoolCreated', - StakingPoolEarnedRewardsInEpoch = 'StakingPoolEarnedRewardsInEpoch', - Unstake = 'Unstake', -} - -export interface TestStakingAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface TestStakingAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface TestStakingEpochEndedEventArgs extends DecodedLogArgs { - epoch: BigNumber; - numPoolsToFinalize: BigNumber; - rewardsAvailable: BigNumber; - totalFeesCollected: BigNumber; - totalWeightedStake: BigNumber; -} - -export interface TestStakingEpochFinalizedEventArgs extends DecodedLogArgs { - epoch: BigNumber; - rewardsPaid: BigNumber; - rewardsRemaining: BigNumber; -} - -export interface TestStakingExchangeAddedEventArgs extends DecodedLogArgs { - exchangeAddress: string; -} - -export interface TestStakingExchangeRemovedEventArgs extends DecodedLogArgs { - exchangeAddress: string; -} - -export interface TestStakingMakerStakingPoolSetEventArgs extends DecodedLogArgs { - makerAddress: string; - poolId: string; -} - -export interface TestStakingMoveStakeEventArgs extends DecodedLogArgs { - staker: string; - amount: BigNumber; - fromStatus: number; - fromPool: string; - toStatus: number; - toPool: string; -} - -export interface TestStakingOperatorShareDecreasedEventArgs extends DecodedLogArgs { - poolId: string; - oldOperatorShare: number; - newOperatorShare: number; -} - -export interface TestStakingOwnershipTransferredEventArgs extends DecodedLogArgs { - previousOwner: string; - newOwner: string; -} - -export interface TestStakingParamsSetEventArgs extends DecodedLogArgs { - epochDurationInSeconds: BigNumber; - rewardDelegatedStakeWeight: number; - minimumPoolStake: BigNumber; - cobbDouglasAlphaNumerator: BigNumber; - cobbDouglasAlphaDenominator: BigNumber; -} - -export interface TestStakingRewardsPaidEventArgs extends DecodedLogArgs { - epoch: BigNumber; - poolId: string; - operatorReward: BigNumber; - membersReward: BigNumber; -} - -export interface TestStakingStakeEventArgs extends DecodedLogArgs { - staker: string; - amount: BigNumber; -} - -export interface TestStakingStakingPoolCreatedEventArgs extends DecodedLogArgs { - poolId: string; - operator: string; - operatorShare: number; -} - -export interface TestStakingStakingPoolEarnedRewardsInEpochEventArgs extends DecodedLogArgs { - epoch: BigNumber; - poolId: string; -} - -export interface TestStakingUnstakeEventArgs extends DecodedLogArgs { - staker: string; - amount: BigNumber; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestStakingContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - public addAuthorizedAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('target', target); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string): string { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public addExchangeAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - addr: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('addExchangeAddress(address)', [addr.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.addExchangeAddress.callAsync(addr, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - addr: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.addExchangeAddress.sendTransactionAsync(addr.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(addr: string, txData?: Partial | undefined): Promise { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('addExchangeAddress(address)', [addr.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(addr: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('addr', addr); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('addExchangeAddress(address)', [addr.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('addExchangeAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(addr: string): string { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addExchangeAddress(address)', [ - addr.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('addExchangeAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public aggregatedStatsByEpoch = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]> { - assert.isBigNumber('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('aggregatedStatsByEpoch(uint256)', [index_0]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('aggregatedStatsByEpoch(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]>( - rawCallResult, - ); - // tslint:enable boolean-naming - return result; - }, - }; - public authorities = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isBigNumber('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorized = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public cobbDouglasAlphaDenominator = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('cobbDouglasAlphaDenominator()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('cobbDouglasAlphaDenominator()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public cobbDouglasAlphaNumerator = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('cobbDouglasAlphaNumerator()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('cobbDouglasAlphaNumerator()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public computeRewardBalanceOfDelegator = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - poolId: string, - member: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('poolId', poolId); - assert.isString('member', member); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('computeRewardBalanceOfDelegator(bytes32,address)', [ - poolId, - member.toLowerCase(), - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('computeRewardBalanceOfDelegator(bytes32,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public computeRewardBalanceOfOperator = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - poolId: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('computeRewardBalanceOfOperator(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('computeRewardBalanceOfOperator(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public createStakingPool = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - operatorShare: number | BigNumber, - addOperatorAsMaker: boolean, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isNumberOrBigNumber('operatorShare', operatorShare); - assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ - operatorShare, - addOperatorAsMaker, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.createStakingPool.callAsync(operatorShare, addOperatorAsMaker, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - operatorShare: number | BigNumber, - addOperatorAsMaker: boolean, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isNumberOrBigNumber('operatorShare', operatorShare); - assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.createStakingPool.sendTransactionAsync( - operatorShare, - addOperatorAsMaker, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - operatorShare: number | BigNumber, - addOperatorAsMaker: boolean, - txData?: Partial | undefined, - ): Promise { - assert.isNumberOrBigNumber('operatorShare', operatorShare); - assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ - operatorShare, - addOperatorAsMaker, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - operatorShare: number | BigNumber, - addOperatorAsMaker: boolean, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isNumberOrBigNumber('operatorShare', operatorShare); - assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ - operatorShare, - addOperatorAsMaker, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('createStakingPool(uint32,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(operatorShare: number | BigNumber, addOperatorAsMaker: boolean): string { - assert.isNumberOrBigNumber('operatorShare', operatorShare); - assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('createStakingPool(uint32,bool)', [ - operatorShare, - addOperatorAsMaker, - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('createStakingPool(uint32,bool)'); - return abiEncoder.getSelector(); - }, - }; - public currentEpoch = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('currentEpoch()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('currentEpoch()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public currentEpochStartTimeInSeconds = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('currentEpochStartTimeInSeconds()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('currentEpochStartTimeInSeconds()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public decreaseStakingPoolOperatorShare = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - poolId: string, - newOperatorShare: number | BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('poolId', poolId); - assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('decreaseStakingPoolOperatorShare(bytes32,uint32)', [ - poolId, - newOperatorShare, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.decreaseStakingPoolOperatorShare.callAsync(poolId, newOperatorShare, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - poolId: string, - newOperatorShare: number | BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('poolId', poolId); - assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.decreaseStakingPoolOperatorShare.sendTransactionAsync( - poolId, - newOperatorShare, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - poolId: string, - newOperatorShare: number | BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('poolId', poolId); - assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('decreaseStakingPoolOperatorShare(bytes32,uint32)', [ - poolId, - newOperatorShare, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - poolId: string, - newOperatorShare: number | BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('poolId', poolId); - assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('decreaseStakingPoolOperatorShare(bytes32,uint32)', [ - poolId, - newOperatorShare, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('decreaseStakingPoolOperatorShare(bytes32,uint32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(poolId: string, newOperatorShare: number | BigNumber): string { - assert.isString('poolId', poolId); - assert.isNumberOrBigNumber('newOperatorShare', newOperatorShare); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'decreaseStakingPoolOperatorShare(bytes32,uint32)', - [poolId, newOperatorShare], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('decreaseStakingPoolOperatorShare(bytes32,uint32)'); - return abiEncoder.getSelector(); - }, - }; - public endEpoch = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('endEpoch()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.endEpoch.callAsync(txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - const self = (this as any) as TestStakingContract; - const txHashPromise = self.endEpoch.sendTransactionAsync(txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('endEpoch()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('endEpoch()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('endEpoch()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('endEpoch()', []); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('endEpoch()'); - return abiEncoder.getSelector(); - }, - }; - public epochDurationInSeconds = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('epochDurationInSeconds()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('epochDurationInSeconds()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public finalizePool = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - poolId: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.finalizePool.callAsync(poolId, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - poolId: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.finalizePool.sendTransactionAsync(poolId, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(poolId: string, txData?: Partial | undefined): Promise { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(poolId: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('finalizePool(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(poolId: string): string { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('finalizePool(bytes32)', [poolId]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('finalizePool(bytes32)'); - return abiEncoder.getSelector(); - }, - }; - public getAuthorizedAddresses = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getCurrentEpochEarliestEndTimeInSeconds = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getCurrentEpochEarliestEndTimeInSeconds()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getCurrentEpochEarliestEndTimeInSeconds()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getGlobalStakeByStatus = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - stakeStatus: number | BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { - assert.isNumberOrBigNumber('stakeStatus', stakeStatus); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getGlobalStakeByStatus(uint8)', [stakeStatus]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getGlobalStakeByStatus(uint8)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - currentEpoch: BigNumber; - currentEpochBalance: BigNumber; - nextEpochBalance: BigNumber; - }>(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getOwnerStakeByStatus = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - stakeStatus: number | BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { - assert.isString('staker', staker); - assert.isNumberOrBigNumber('stakeStatus', stakeStatus); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getOwnerStakeByStatus(address,uint8)', [ - staker.toLowerCase(), - stakeStatus, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOwnerStakeByStatus(address,uint8)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - currentEpoch: BigNumber; - currentEpochBalance: BigNumber; - nextEpochBalance: BigNumber; - }>(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getParams = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber, number, BigNumber, number, number]> { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getParams()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getParams()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, number, BigNumber, number, number]>( - rawCallResult, - ); - // tslint:enable boolean-naming - return result; - }, - }; - public getStakeDelegatedToPoolByOwner = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - poolId: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { - assert.isString('staker', staker); - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getStakeDelegatedToPoolByOwner(address,bytes32)', [ - staker.toLowerCase(), - poolId, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getStakeDelegatedToPoolByOwner(address,bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - currentEpoch: BigNumber; - currentEpochBalance: BigNumber; - nextEpochBalance: BigNumber; - }>(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getStakingPool = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - poolId: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ operator: string; operatorShare: number }> { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getStakingPool(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getStakingPool(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ operator: string; operatorShare: number }>( - rawCallResult, - ); - // tslint:enable boolean-naming - return result; - }, - }; - public getStakingPoolStatsThisEpoch = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - poolId: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ feesCollected: BigNumber; weightedStake: BigNumber; membersStake: BigNumber }> { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getStakingPoolStatsThisEpoch(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getStakingPoolStatsThisEpoch(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - feesCollected: BigNumber; - weightedStake: BigNumber; - membersStake: BigNumber; - }>(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getTotalStake = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('staker', staker); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getTotalStake(address)', [staker.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTotalStake(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getTotalStakeDelegatedToPool = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - poolId: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ currentEpoch: BigNumber; currentEpochBalance: BigNumber; nextEpochBalance: BigNumber }> { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getTotalStakeDelegatedToPool(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTotalStakeDelegatedToPool(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - currentEpoch: BigNumber; - currentEpochBalance: BigNumber; - nextEpochBalance: BigNumber; - }>(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getWethContract = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getWethContract()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getWethContract()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getZrxVault = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('getZrxVault()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getZrxVault()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public init = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('init()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.init.callAsync(txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - const self = (this as any) as TestStakingContract; - const txHashPromise = self.init.sendTransactionAsync(txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('init()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('init()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('init()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('init()', []); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('init()'); - return abiEncoder.getSelector(); - }, - }; - public joinStakingPoolAsMaker = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - poolId: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.joinStakingPoolAsMaker.callAsync(poolId, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - poolId: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.joinStakingPoolAsMaker.sendTransactionAsync(poolId, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(poolId: string, txData?: Partial | undefined): Promise { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(poolId: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('joinStakingPoolAsMaker(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(poolId: string): string { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('joinStakingPoolAsMaker(bytes32)', [poolId]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('joinStakingPoolAsMaker(bytes32)'); - return abiEncoder.getSelector(); - }, - }; - public lastPoolId = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('lastPoolId()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('lastPoolId()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public minimumPoolStake = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('minimumPoolStake()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('minimumPoolStake()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public moveStake = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - from: { status: number | BigNumber; poolId: string }, - to: { status: number | BigNumber; poolId: string }, - amount: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('moveStake((uint8,bytes32),(uint8,bytes32),uint256)', [ - from, - to, - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.moveStake.callAsync(from, to, amount, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - from: { status: number | BigNumber; poolId: string }, - to: { status: number | BigNumber; poolId: string }, - amount: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.moveStake.sendTransactionAsync(from, to, amount, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - from: { status: number | BigNumber; poolId: string }, - to: { status: number | BigNumber; poolId: string }, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('moveStake((uint8,bytes32),(uint8,bytes32),uint256)', [ - from, - to, - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - from: { status: number | BigNumber; poolId: string }, - to: { status: number | BigNumber; poolId: string }, - amount: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isBigNumber('amount', amount); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('moveStake((uint8,bytes32),(uint8,bytes32),uint256)', [ - from, - to, - amount, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('moveStake((uint8,bytes32),(uint8,bytes32),uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData( - from: { status: number | BigNumber; poolId: string }, - to: { status: number | BigNumber; poolId: string }, - amount: BigNumber, - ): string { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'moveStake((uint8,bytes32),(uint8,bytes32),uint256)', - [from, to, amount], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('moveStake((uint8,bytes32),(uint8,bytes32),uint256)'); - return abiEncoder.getSelector(); - }, - }; - public owner = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('owner()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public payProtocolFee = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - makerAddress: string, - payerAddress: string, - protocolFee: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('makerAddress', makerAddress); - assert.isString('payerAddress', payerAddress); - assert.isBigNumber('protocolFee', protocolFee); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ - makerAddress.toLowerCase(), - payerAddress.toLowerCase(), - protocolFee, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.payProtocolFee.callAsync(makerAddress, payerAddress, protocolFee, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - makerAddress: string, - payerAddress: string, - protocolFee: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('makerAddress', makerAddress); - assert.isString('payerAddress', payerAddress); - assert.isBigNumber('protocolFee', protocolFee); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.payProtocolFee.sendTransactionAsync( - makerAddress.toLowerCase(), - payerAddress.toLowerCase(), - protocolFee, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - makerAddress: string, - payerAddress: string, - protocolFee: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('makerAddress', makerAddress); - assert.isString('payerAddress', payerAddress); - assert.isBigNumber('protocolFee', protocolFee); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ - makerAddress.toLowerCase(), - payerAddress.toLowerCase(), - protocolFee, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - makerAddress: string, - payerAddress: string, - protocolFee: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('makerAddress', makerAddress); - assert.isString('payerAddress', payerAddress); - assert.isBigNumber('protocolFee', protocolFee); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ - makerAddress.toLowerCase(), - payerAddress.toLowerCase(), - protocolFee, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('payProtocolFee(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(makerAddress: string, payerAddress: string, protocolFee: BigNumber): string { - assert.isString('makerAddress', makerAddress); - assert.isString('payerAddress', payerAddress); - assert.isBigNumber('protocolFee', protocolFee); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('payProtocolFee(address,address,uint256)', [ - makerAddress.toLowerCase(), - payerAddress.toLowerCase(), - protocolFee, - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('payProtocolFee(address,address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - public poolIdByMaker = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('poolIdByMaker(address)', [index_0.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('poolIdByMaker(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public poolStatsByEpoch = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: string, - index_1: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber, BigNumber]> { - assert.isString('index_0', index_0); - assert.isBigNumber('index_1', index_1); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('poolStatsByEpoch(bytes32,uint256)', [index_0, index_1]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('poolStatsByEpoch(bytes32,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber, BigNumber]>(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('target', target); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string): string { - assert.isString('target', target); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public removeAuthorizedAddressAtIndex = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - index: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - target: string, - index: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string, index: BigNumber): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - public removeExchangeAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - addr: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeExchangeAddress(address)', [addr.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeExchangeAddress.callAsync(addr, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - addr: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.removeExchangeAddress.sendTransactionAsync(addr.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(addr: string, txData?: Partial | undefined): Promise { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeExchangeAddress(address)', [addr.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(addr: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('addr', addr); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('removeExchangeAddress(address)', [addr.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeExchangeAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(addr: string): string { - assert.isString('addr', addr); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeExchangeAddress(address)', [ - addr.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('removeExchangeAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public rewardDelegatedStakeWeight = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('rewardDelegatedStakeWeight()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('rewardDelegatedStakeWeight()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public rewardsByPoolId = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('rewardsByPoolId(bytes32)', [index_0]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('rewardsByPoolId(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public setParams = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - _epochDurationInSeconds: BigNumber, - _rewardDelegatedStakeWeight: number | BigNumber, - _minimumPoolStake: BigNumber, - _cobbDouglasAlphaNumerator: number | BigNumber, - _cobbDouglasAlphaDenominator: number | BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); - assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); - assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); - assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); - assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setParams(uint256,uint32,uint256,uint32,uint32)', [ - _epochDurationInSeconds, - _rewardDelegatedStakeWeight, - _minimumPoolStake, - _cobbDouglasAlphaNumerator, - _cobbDouglasAlphaDenominator, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.setParams.callAsync( - _epochDurationInSeconds, - _rewardDelegatedStakeWeight, - _minimumPoolStake, - _cobbDouglasAlphaNumerator, - _cobbDouglasAlphaDenominator, - txDataWithDefaults, - ); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - _epochDurationInSeconds: BigNumber, - _rewardDelegatedStakeWeight: number | BigNumber, - _minimumPoolStake: BigNumber, - _cobbDouglasAlphaNumerator: number | BigNumber, - _cobbDouglasAlphaDenominator: number | BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); - assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); - assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); - assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); - assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.setParams.sendTransactionAsync( - _epochDurationInSeconds, - _rewardDelegatedStakeWeight, - _minimumPoolStake, - _cobbDouglasAlphaNumerator, - _cobbDouglasAlphaDenominator, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - _epochDurationInSeconds: BigNumber, - _rewardDelegatedStakeWeight: number | BigNumber, - _minimumPoolStake: BigNumber, - _cobbDouglasAlphaNumerator: number | BigNumber, - _cobbDouglasAlphaDenominator: number | BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); - assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); - assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); - assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); - assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setParams(uint256,uint32,uint256,uint32,uint32)', [ - _epochDurationInSeconds, - _rewardDelegatedStakeWeight, - _minimumPoolStake, - _cobbDouglasAlphaNumerator, - _cobbDouglasAlphaDenominator, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - _epochDurationInSeconds: BigNumber, - _rewardDelegatedStakeWeight: number | BigNumber, - _minimumPoolStake: BigNumber, - _cobbDouglasAlphaNumerator: number | BigNumber, - _cobbDouglasAlphaDenominator: number | BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); - assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); - assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); - assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); - assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setParams(uint256,uint32,uint256,uint32,uint32)', [ - _epochDurationInSeconds, - _rewardDelegatedStakeWeight, - _minimumPoolStake, - _cobbDouglasAlphaNumerator, - _cobbDouglasAlphaDenominator, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('setParams(uint256,uint32,uint256,uint32,uint32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData( - _epochDurationInSeconds: BigNumber, - _rewardDelegatedStakeWeight: number | BigNumber, - _minimumPoolStake: BigNumber, - _cobbDouglasAlphaNumerator: number | BigNumber, - _cobbDouglasAlphaDenominator: number | BigNumber, - ): string { - assert.isBigNumber('_epochDurationInSeconds', _epochDurationInSeconds); - assert.isNumberOrBigNumber('_rewardDelegatedStakeWeight', _rewardDelegatedStakeWeight); - assert.isBigNumber('_minimumPoolStake', _minimumPoolStake); - assert.isNumberOrBigNumber('_cobbDouglasAlphaNumerator', _cobbDouglasAlphaNumerator); - assert.isNumberOrBigNumber('_cobbDouglasAlphaDenominator', _cobbDouglasAlphaDenominator); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'setParams(uint256,uint32,uint256,uint32,uint32)', - [ - _epochDurationInSeconds, - _rewardDelegatedStakeWeight, - _minimumPoolStake, - _cobbDouglasAlphaNumerator, - _cobbDouglasAlphaDenominator, - ], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('setParams(uint256,uint32,uint256,uint32,uint32)'); - return abiEncoder.getSelector(); - }, - }; - public setWethContract = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - wethAddress: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('wethAddress', wethAddress); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setWethContract(address)', [wethAddress.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.setWethContract.callAsync(wethAddress, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - wethAddress: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('wethAddress', wethAddress); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.setWethContract.sendTransactionAsync(wethAddress.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(wethAddress: string, txData?: Partial | undefined): Promise { - assert.isString('wethAddress', wethAddress); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setWethContract(address)', [wethAddress.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - wethAddress: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('wethAddress', wethAddress); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setWethContract(address)', [wethAddress.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('setWethContract(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(wethAddress: string): string { - assert.isString('wethAddress', wethAddress); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setWethContract(address)', [ - wethAddress.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('setWethContract(address)'); - return abiEncoder.getSelector(); - }, - }; - public setZrxVault = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - zrxVaultAddress: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('zrxVaultAddress', zrxVaultAddress); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setZrxVault(address)', [zrxVaultAddress.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.setZrxVault.callAsync(zrxVaultAddress, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - zrxVaultAddress: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('zrxVaultAddress', zrxVaultAddress); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.setZrxVault.sendTransactionAsync(zrxVaultAddress.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(zrxVaultAddress: string, txData?: Partial | undefined): Promise { - assert.isString('zrxVaultAddress', zrxVaultAddress); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setZrxVault(address)', [zrxVaultAddress.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - zrxVaultAddress: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('zrxVaultAddress', zrxVaultAddress); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('setZrxVault(address)', [zrxVaultAddress.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('setZrxVault(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(zrxVaultAddress: string): string { - assert.isString('zrxVaultAddress', zrxVaultAddress); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setZrxVault(address)', [ - zrxVaultAddress.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('setZrxVault(address)'); - return abiEncoder.getSelector(); - }, - }; - public stake = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - amount: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('stake(uint256)', [amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.stake.callAsync(amount, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - amount: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.stake.sendTransactionAsync(amount, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(amount: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('stake(uint256)', [amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isBigNumber('amount', amount); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('stake(uint256)', [amount]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('stake(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(amount: BigNumber): string { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('stake(uint256)', [amount]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('stake(uint256)'); - return abiEncoder.getSelector(); - }, - }; - public stakingContract = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('stakingContract()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('stakingContract()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public testWethAddress = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('testWethAddress()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('testWethAddress()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public testZrxVaultAddress = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('testZrxVaultAddress()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('testZrxVaultAddress()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - newOwner: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('newOwner', newOwner); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(newOwner: string): string { - assert.isString('newOwner', newOwner); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - return abiEncoder.getSelector(); - }, - }; - public unstake = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - amount: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('unstake(uint256)', [amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.unstake.callAsync(amount, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - amount: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.unstake.sendTransactionAsync(amount, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(amount: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('unstake(uint256)', [amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isBigNumber('amount', amount); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('unstake(uint256)', [amount]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('unstake(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(amount: BigNumber): string { - assert.isBigNumber('amount', amount); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('unstake(uint256)', [amount]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('unstake(uint256)'); - return abiEncoder.getSelector(); - }, - }; - public validExchanges = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('validExchanges(address)', [index_0.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('validExchanges(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public wethReservedForPoolRewards = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('wethReservedForPoolRewards()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('wethReservedForPoolRewards()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public withdrawDelegatorRewards = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - poolId: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [poolId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.withdrawDelegatorRewards.callAsync(poolId, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - poolId: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const txHashPromise = self.withdrawDelegatorRewards.sendTransactionAsync(poolId, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(poolId: string, txData?: Partial | undefined): Promise { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [poolId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(poolId: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('poolId', poolId); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as TestStakingContract; - const encodedData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [poolId]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('withdrawDelegatorRewards(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(poolId: string): string { - assert.isString('poolId', poolId); - const self = (this as any) as TestStakingContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawDelegatorRewards(bytes32)', [ - poolId, - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as TestStakingContract; - const abiEncoder = self._lookupAbiEncoder('withdrawDelegatorRewards(bytes32)'); - return abiEncoder.getSelector(); - }, - }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - wethAddress: string, - zrxVaultAddress: string, - ): Promise { - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (artifact.compilerOutput === undefined) { - throw new Error('Compiler output not found in the artifact file'); - } - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; - if (Object.keys(logDecodeDependencies) !== undefined) { - for (const key of Object.keys(logDecodeDependencies)) { - logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; - } - } - return TestStakingContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - wethAddress, - zrxVaultAddress, - ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - wethAddress: string, - zrxVaultAddress: string, - ): Promise { - assert.isHexString('bytecode', bytecode); - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [wethAddress, zrxVaultAddress] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [wethAddress, zrxVaultAddress], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [wethAddress, zrxVaultAddress]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestStaking successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestStakingContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [wethAddress, zrxVaultAddress]; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - inputs: [ - { - name: 'wethAddress', - type: 'address', - }, - { - name: 'zrxVaultAddress', - type: 'address', - }, - ], - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - name: 'target', - type: 'address', - indexed: true, - }, - { - name: 'caller', - type: 'address', - indexed: true, - }, - ], - name: 'AuthorizedAddressAdded', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'target', - type: 'address', - indexed: true, - }, - { - name: 'caller', - type: 'address', - indexed: true, - }, - ], - name: 'AuthorizedAddressRemoved', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'epoch', - type: 'uint256', - indexed: true, - }, - { - name: 'numPoolsToFinalize', - type: 'uint256', - indexed: false, - }, - { - name: 'rewardsAvailable', - type: 'uint256', - indexed: false, - }, - { - name: 'totalFeesCollected', - type: 'uint256', - indexed: false, - }, - { - name: 'totalWeightedStake', - type: 'uint256', - indexed: false, - }, - ], - name: 'EpochEnded', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'epoch', - type: 'uint256', - indexed: true, - }, - { - name: 'rewardsPaid', - type: 'uint256', - indexed: false, - }, - { - name: 'rewardsRemaining', - type: 'uint256', - indexed: false, - }, - ], - name: 'EpochFinalized', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'exchangeAddress', - type: 'address', - indexed: false, - }, - ], - name: 'ExchangeAdded', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'exchangeAddress', - type: 'address', - indexed: false, - }, - ], - name: 'ExchangeRemoved', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'makerAddress', - type: 'address', - indexed: true, - }, - { - name: 'poolId', - type: 'bytes32', - indexed: true, - }, - ], - name: 'MakerStakingPoolSet', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'staker', - type: 'address', - indexed: true, - }, - { - name: 'amount', - type: 'uint256', - indexed: false, - }, - { - name: 'fromStatus', - type: 'uint8', - indexed: false, - }, - { - name: 'fromPool', - type: 'bytes32', - indexed: true, - }, - { - name: 'toStatus', - type: 'uint8', - indexed: false, - }, - { - name: 'toPool', - type: 'bytes32', - indexed: true, - }, - ], - name: 'MoveStake', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - indexed: true, - }, - { - name: 'oldOperatorShare', - type: 'uint32', - indexed: false, - }, - { - name: 'newOperatorShare', - type: 'uint32', - indexed: false, - }, - ], - name: 'OperatorShareDecreased', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'previousOwner', - type: 'address', - indexed: true, - }, - { - name: 'newOwner', - type: 'address', - indexed: true, - }, - ], - name: 'OwnershipTransferred', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'epochDurationInSeconds', - type: 'uint256', - indexed: false, - }, - { - name: 'rewardDelegatedStakeWeight', - type: 'uint32', - indexed: false, - }, - { - name: 'minimumPoolStake', - type: 'uint256', - indexed: false, - }, - { - name: 'cobbDouglasAlphaNumerator', - type: 'uint256', - indexed: false, - }, - { - name: 'cobbDouglasAlphaDenominator', - type: 'uint256', - indexed: false, - }, - ], - name: 'ParamsSet', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'epoch', - type: 'uint256', - indexed: true, - }, - { - name: 'poolId', - type: 'bytes32', - indexed: true, - }, - { - name: 'operatorReward', - type: 'uint256', - indexed: false, - }, - { - name: 'membersReward', - type: 'uint256', - indexed: false, - }, - ], - name: 'RewardsPaid', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'staker', - type: 'address', - indexed: true, - }, - { - name: 'amount', - type: 'uint256', - indexed: false, - }, - ], - name: 'Stake', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - indexed: false, - }, - { - name: 'operator', - type: 'address', - indexed: false, - }, - { - name: 'operatorShare', - type: 'uint32', - indexed: false, - }, - ], - name: 'StakingPoolCreated', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'epoch', - type: 'uint256', - indexed: true, - }, - { - name: 'poolId', - type: 'bytes32', - indexed: true, - }, - ], - name: 'StakingPoolEarnedRewardsInEpoch', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'staker', - type: 'address', - indexed: true, - }, - { - name: 'amount', - type: 'uint256', - indexed: false, - }, - ], - name: 'Unstake', - outputs: [], - type: 'event', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - ], - name: 'addAuthorizedAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'addr', - type: 'address', - }, - ], - name: 'addExchangeAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'uint256', - }, - ], - name: 'aggregatedStatsByEpoch', - outputs: [ - { - name: 'rewardsAvailable', - type: 'uint256', - }, - { - name: 'numPoolsToFinalize', - type: 'uint256', - }, - { - name: 'totalFeesCollected', - type: 'uint256', - }, - { - name: 'totalWeightedStake', - type: 'uint256', - }, - { - name: 'totalRewardsFinalized', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'uint256', - }, - ], - name: 'authorities', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'address', - }, - ], - name: 'authorized', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'cobbDouglasAlphaDenominator', - outputs: [ - { - name: '', - type: 'uint32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'cobbDouglasAlphaNumerator', - outputs: [ - { - name: '', - type: 'uint32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - { - name: 'member', - type: 'address', - }, - ], - name: 'computeRewardBalanceOfDelegator', - outputs: [ - { - name: 'reward', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'computeRewardBalanceOfOperator', - outputs: [ - { - name: 'reward', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'operatorShare', - type: 'uint32', - }, - { - name: 'addOperatorAsMaker', - type: 'bool', - }, - ], - name: 'createStakingPool', - outputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'currentEpoch', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'currentEpochStartTimeInSeconds', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - { - name: 'newOperatorShare', - type: 'uint32', - }, - ], - name: 'decreaseStakingPoolOperatorShare', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [], - name: 'endEpoch', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'epochDurationInSeconds', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'finalizePool', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getAuthorizedAddresses', - outputs: [ - { - name: '', - type: 'address[]', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getCurrentEpochEarliestEndTimeInSeconds', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'stakeStatus', - type: 'uint8', - }, - ], - name: 'getGlobalStakeByStatus', - outputs: [ - { - name: 'balance', - type: 'tuple', - components: [ - { - name: 'currentEpoch', - type: 'uint64', - }, - { - name: 'currentEpochBalance', - type: 'uint96', - }, - { - name: 'nextEpochBalance', - type: 'uint96', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'staker', - type: 'address', - }, - { - name: 'stakeStatus', - type: 'uint8', - }, - ], - name: 'getOwnerStakeByStatus', - outputs: [ - { - name: 'balance', - type: 'tuple', - components: [ - { - name: 'currentEpoch', - type: 'uint64', - }, - { - name: 'currentEpochBalance', - type: 'uint96', - }, - { - name: 'nextEpochBalance', - type: 'uint96', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getParams', - outputs: [ - { - name: '_epochDurationInSeconds', - type: 'uint256', - }, - { - name: '_rewardDelegatedStakeWeight', - type: 'uint32', - }, - { - name: '_minimumPoolStake', - type: 'uint256', - }, - { - name: '_cobbDouglasAlphaNumerator', - type: 'uint32', - }, - { - name: '_cobbDouglasAlphaDenominator', - type: 'uint32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'staker', - type: 'address', - }, - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'getStakeDelegatedToPoolByOwner', - outputs: [ - { - name: 'balance', - type: 'tuple', - components: [ - { - name: 'currentEpoch', - type: 'uint64', - }, - { - name: 'currentEpochBalance', - type: 'uint96', - }, - { - name: 'nextEpochBalance', - type: 'uint96', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'getStakingPool', - outputs: [ - { - name: '', - type: 'tuple', - components: [ - { - name: 'operator', - type: 'address', - }, - { - name: 'operatorShare', - type: 'uint32', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'getStakingPoolStatsThisEpoch', - outputs: [ - { - name: '', - type: 'tuple', - components: [ - { - name: 'feesCollected', - type: 'uint256', - }, - { - name: 'weightedStake', - type: 'uint256', - }, - { - name: 'membersStake', - type: 'uint256', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'staker', - type: 'address', - }, - ], - name: 'getTotalStake', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'getTotalStakeDelegatedToPool', - outputs: [ - { - name: 'balance', - type: 'tuple', - components: [ - { - name: 'currentEpoch', - type: 'uint64', - }, - { - name: 'currentEpochBalance', - type: 'uint96', - }, - { - name: 'nextEpochBalance', - type: 'uint96', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getWethContract', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getZrxVault', - outputs: [ - { - name: 'zrxVault', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [], - name: 'init', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'joinStakingPoolAsMaker', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'lastPoolId', - outputs: [ - { - name: '', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'minimumPoolStake', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'from', - type: 'tuple', - components: [ - { - name: 'status', - type: 'uint8', - }, - { - name: 'poolId', - type: 'bytes32', - }, - ], - }, - { - name: 'to', - type: 'tuple', - components: [ - { - name: 'status', - type: 'uint8', - }, - { - name: 'poolId', - type: 'bytes32', - }, - ], - }, - { - name: 'amount', - type: 'uint256', - }, - ], - name: 'moveStake', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'owner', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'makerAddress', - type: 'address', - }, - { - name: 'payerAddress', - type: 'address', - }, - { - name: 'protocolFee', - type: 'uint256', - }, - ], - name: 'payProtocolFee', - outputs: [], - payable: true, - stateMutability: 'payable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'address', - }, - ], - name: 'poolIdByMaker', - outputs: [ - { - name: '', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'bytes32', - }, - { - name: 'index_1', - type: 'uint256', - }, - ], - name: 'poolStatsByEpoch', - outputs: [ - { - name: 'feesCollected', - type: 'uint256', - }, - { - name: 'weightedStake', - type: 'uint256', - }, - { - name: 'membersStake', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - ], - name: 'removeAuthorizedAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - { - name: 'index', - type: 'uint256', - }, - ], - name: 'removeAuthorizedAddressAtIndex', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'addr', - type: 'address', - }, - ], - name: 'removeExchangeAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'rewardDelegatedStakeWeight', - outputs: [ - { - name: '', - type: 'uint32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'bytes32', - }, - ], - name: 'rewardsByPoolId', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_epochDurationInSeconds', - type: 'uint256', - }, - { - name: '_rewardDelegatedStakeWeight', - type: 'uint32', - }, - { - name: '_minimumPoolStake', - type: 'uint256', - }, - { - name: '_cobbDouglasAlphaNumerator', - type: 'uint32', - }, - { - name: '_cobbDouglasAlphaDenominator', - type: 'uint32', - }, - ], - name: 'setParams', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'wethAddress', - type: 'address', - }, - ], - name: 'setWethContract', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'zrxVaultAddress', - type: 'address', - }, - ], - name: 'setZrxVault', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'amount', - type: 'uint256', - }, - ], - name: 'stake', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'stakingContract', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'testWethAddress', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'testZrxVaultAddress', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'amount', - type: 'uint256', - }, - ], - name: 'unstake', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'address', - }, - ], - name: 'validExchanges', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'wethReservedForPoolRewards', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'poolId', - type: 'bytes32', - }, - ], - name: 'withdrawDelegatorRewards', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - /** - * Subscribe to an event type emitted by the TestStaking contract. - * @param eventName The TestStaking contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: TestStakingEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, TestStakingEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - TestStakingContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The TestStaking contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: TestStakingEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, TestStakingEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - TestStakingContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = TestStakingContract.deployedBytecode, - ) { - super( - 'TestStaking', - TestStakingContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - TestStakingContract.ABI(), - this._web3Wrapper, - ); - } -} - -// tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align -// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts deleted file mode 100644 index 7f364cf7c8..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts +++ /dev/null @@ -1,2719 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { BaseContract, SubscriptionManager, PromiseWithTransactionHash } from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { - AwaitTransactionSuccessOpts, - EventCallback, - IndexedFilterValues, - SendTransactionOpts, - SimpleContractArtifact, -} from '@0x/types'; -import { Web3Wrapper } from '@0x/web3-wrapper'; -import { assert } from '@0x/assert'; -import * as ethers from 'ethers'; -// tslint:enable:no-unused-variable - -export type ZrxVaultEventArgs = - | ZrxVaultAuthorizedAddressAddedEventArgs - | ZrxVaultAuthorizedAddressRemovedEventArgs - | ZrxVaultDepositEventArgs - | ZrxVaultInCatastrophicFailureModeEventArgs - | ZrxVaultOwnershipTransferredEventArgs - | ZrxVaultStakingProxySetEventArgs - | ZrxVaultWithdrawEventArgs - | ZrxVaultZrxProxySetEventArgs; - -export enum ZrxVaultEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', - Deposit = 'Deposit', - InCatastrophicFailureMode = 'InCatastrophicFailureMode', - OwnershipTransferred = 'OwnershipTransferred', - StakingProxySet = 'StakingProxySet', - Withdraw = 'Withdraw', - ZrxProxySet = 'ZrxProxySet', -} - -export interface ZrxVaultAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface ZrxVaultAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface ZrxVaultDepositEventArgs extends DecodedLogArgs { - staker: string; - amount: BigNumber; -} - -export interface ZrxVaultInCatastrophicFailureModeEventArgs extends DecodedLogArgs { - sender: string; -} - -export interface ZrxVaultOwnershipTransferredEventArgs extends DecodedLogArgs { - previousOwner: string; - newOwner: string; -} - -export interface ZrxVaultStakingProxySetEventArgs extends DecodedLogArgs { - stakingProxyAddress: string; -} - -export interface ZrxVaultWithdrawEventArgs extends DecodedLogArgs { - staker: string; - amount: BigNumber; -} - -export interface ZrxVaultZrxProxySetEventArgs extends DecodedLogArgs { - zrxProxyAddress: string; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ZrxVaultContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - public addAuthorizedAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('target', target); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string): string { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public authorities = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isBigNumber('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorized = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('index_0', index_0); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('staker', staker); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [staker.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOfZrxVault = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('balanceOfZrxVault()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('balanceOfZrxVault()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public depositFrom = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - staker: string, - amount: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('depositFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.depositFrom.callAsync(staker, amount, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - staker: string, - amount: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.depositFrom.sendTransactionAsync(staker.toLowerCase(), amount, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - staker: string, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('depositFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - amount: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('depositFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('depositFrom(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(staker: string, amount: BigNumber): string { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('depositFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('depositFrom(address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - public enterCatastrophicFailure = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('enterCatastrophicFailure()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.enterCatastrophicFailure.callAsync(txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.enterCatastrophicFailure.sendTransactionAsync(txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('enterCatastrophicFailure()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('enterCatastrophicFailure()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('enterCatastrophicFailure()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('enterCatastrophicFailure()', []); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('enterCatastrophicFailure()'); - return abiEncoder.getSelector(); - }, - }; - public getAuthorizedAddresses = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public isInCatastrophicFailure = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('isInCatastrophicFailure()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('isInCatastrophicFailure()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('owner()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddress = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('target', target); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string): string { - assert.isString('target', target); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - return abiEncoder.getSelector(); - }, - }; - public removeAuthorizedAddressAtIndex = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - target: string, - index: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - target: string, - index: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(target: string, index: BigNumber): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - public setStakingProxy = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - _stakingProxyAddress: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('_stakingProxyAddress', _stakingProxyAddress); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('setStakingProxy(address)', [ - _stakingProxyAddress.toLowerCase(), - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.setStakingProxy.callAsync(_stakingProxyAddress, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - _stakingProxyAddress: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('_stakingProxyAddress', _stakingProxyAddress); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.setStakingProxy.sendTransactionAsync( - _stakingProxyAddress.toLowerCase(), - txData, - opts, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(_stakingProxyAddress: string, txData?: Partial | undefined): Promise { - assert.isString('_stakingProxyAddress', _stakingProxyAddress); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('setStakingProxy(address)', [ - _stakingProxyAddress.toLowerCase(), - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - _stakingProxyAddress: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('_stakingProxyAddress', _stakingProxyAddress); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('setStakingProxy(address)', [ - _stakingProxyAddress.toLowerCase(), - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('setStakingProxy(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_stakingProxyAddress: string): string { - assert.isString('_stakingProxyAddress', _stakingProxyAddress); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setStakingProxy(address)', [ - _stakingProxyAddress.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('setStakingProxy(address)'); - return abiEncoder.getSelector(); - }, - }; - public setZrxProxy = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - _zrxProxyAddress: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('_zrxProxyAddress', _zrxProxyAddress); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('setZrxProxy(address)', [_zrxProxyAddress.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.setZrxProxy.callAsync(_zrxProxyAddress, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - _zrxProxyAddress: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('_zrxProxyAddress', _zrxProxyAddress); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.setZrxProxy.sendTransactionAsync(_zrxProxyAddress.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(_zrxProxyAddress: string, txData?: Partial | undefined): Promise { - assert.isString('_zrxProxyAddress', _zrxProxyAddress); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('setZrxProxy(address)', [_zrxProxyAddress.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - _zrxProxyAddress: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('_zrxProxyAddress', _zrxProxyAddress); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('setZrxProxy(address)', [_zrxProxyAddress.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('setZrxProxy(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_zrxProxyAddress: string): string { - assert.isString('_zrxProxyAddress', _zrxProxyAddress); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setZrxProxy(address)', [ - _zrxProxyAddress.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('setZrxProxy(address)'); - return abiEncoder.getSelector(); - }, - }; - public stakingProxyAddress = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('stakingProxyAddress()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('stakingProxyAddress()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - newOwner: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.isString('newOwner', newOwner); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(newOwner: string): string { - assert.isString('newOwner', newOwner); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - return abiEncoder.getSelector(); - }, - }; - public withdrawAllFrom = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - staker: string, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('staker', staker); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('withdrawAllFrom(address)', [staker.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.withdrawAllFrom.callAsync(staker, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - staker: string, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('staker', staker); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.withdrawAllFrom.sendTransactionAsync(staker.toLowerCase(), txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync(staker: string, txData?: Partial | undefined): Promise { - assert.isString('staker', staker); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('withdrawAllFrom(address)', [staker.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('staker', staker); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('withdrawAllFrom(address)', [staker.toLowerCase()]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('withdrawAllFrom(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(staker: string): string { - assert.isString('staker', staker); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAllFrom(address)', [ - staker.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('withdrawAllFrom(address)'); - return abiEncoder.getSelector(); - }, - }; - public withdrawFrom = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async sendTransactionAsync( - staker: string, - amount: BigNumber, - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - if (opts.shouldValidate !== false) { - await self.withdrawFrom.callAsync(staker, amount, txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - /** - * Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting. - * If the transaction was mined, but reverted, an error is thrown. - * @param txData Additional data for transaction - * @param pollingIntervalMs Interval at which to poll for success - * @returns A promise that resolves when the transaction is successful - */ - awaitTransactionSuccessAsync( - staker: string, - amount: BigNumber, - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const txHashPromise = self.withdrawFrom.sendTransactionAsync(staker.toLowerCase(), amount, txData, opts); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - opts.pollingIntervalMs, - opts.timeoutMs, - ); - })(), - ); - }, - /** - * Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments. - * @param txData Additional data for transaction - * @returns The hash of the transaction - */ - async estimateGasAsync( - staker: string, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync( - staker: string, - amount: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('withdrawFrom(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(staker: string, amount: BigNumber): string { - assert.isString('staker', staker); - assert.isBigNumber('amount', amount); - const self = (this as any) as ZrxVaultContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawFrom(address,uint256)', [ - staker.toLowerCase(), - amount, - ]); - return abiEncodedTransactionData; - }, - /** - * Returns the 4 byte function selector as a hex string. - */ - getSelector(): string { - const self = (this as any) as ZrxVaultContract; - const abiEncoder = self._lookupAbiEncoder('withdrawFrom(address,uint256)'); - return abiEncoder.getSelector(); - }, - }; - public zrxAssetProxy = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - */ - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as ZrxVaultContract; - const encodedData = self._strictEncodeArguments('zrxAssetProxy()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('zrxAssetProxy()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _zrxProxyAddress: string, - _zrxTokenAddress: string, - ): Promise { - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (artifact.compilerOutput === undefined) { - throw new Error('Compiler output not found in the artifact file'); - } - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; - if (Object.keys(logDecodeDependencies) !== undefined) { - for (const key of Object.keys(logDecodeDependencies)) { - logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; - } - } - return ZrxVaultContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _zrxProxyAddress, - _zrxTokenAddress, - ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - _zrxProxyAddress: string, - _zrxTokenAddress: string, - ): Promise { - assert.isHexString('bytecode', bytecode); - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_zrxProxyAddress, _zrxTokenAddress] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_zrxProxyAddress, _zrxTokenAddress], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_zrxProxyAddress, _zrxTokenAddress]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ZrxVault successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ZrxVaultContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_zrxProxyAddress, _zrxTokenAddress]; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - inputs: [ - { - name: '_zrxProxyAddress', - type: 'address', - }, - { - name: '_zrxTokenAddress', - type: 'address', - }, - ], - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - name: 'target', - type: 'address', - indexed: true, - }, - { - name: 'caller', - type: 'address', - indexed: true, - }, - ], - name: 'AuthorizedAddressAdded', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'target', - type: 'address', - indexed: true, - }, - { - name: 'caller', - type: 'address', - indexed: true, - }, - ], - name: 'AuthorizedAddressRemoved', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'staker', - type: 'address', - indexed: true, - }, - { - name: 'amount', - type: 'uint256', - indexed: false, - }, - ], - name: 'Deposit', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'sender', - type: 'address', - indexed: false, - }, - ], - name: 'InCatastrophicFailureMode', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'previousOwner', - type: 'address', - indexed: true, - }, - { - name: 'newOwner', - type: 'address', - indexed: true, - }, - ], - name: 'OwnershipTransferred', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'stakingProxyAddress', - type: 'address', - indexed: false, - }, - ], - name: 'StakingProxySet', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'staker', - type: 'address', - indexed: true, - }, - { - name: 'amount', - type: 'uint256', - indexed: false, - }, - ], - name: 'Withdraw', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'zrxProxyAddress', - type: 'address', - indexed: false, - }, - ], - name: 'ZrxProxySet', - outputs: [], - type: 'event', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - ], - name: 'addAuthorizedAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'uint256', - }, - ], - name: 'authorities', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'address', - }, - ], - name: 'authorized', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'staker', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'balanceOfZrxVault', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'staker', - type: 'address', - }, - { - name: 'amount', - type: 'uint256', - }, - ], - name: 'depositFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [], - name: 'enterCatastrophicFailure', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'getAuthorizedAddresses', - outputs: [ - { - name: '', - type: 'address[]', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'isInCatastrophicFailure', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'owner', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - ], - name: 'removeAuthorizedAddress', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'target', - type: 'address', - }, - { - name: 'index', - type: 'uint256', - }, - ], - name: 'removeAuthorizedAddressAtIndex', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_stakingProxyAddress', - type: 'address', - }, - ], - name: 'setStakingProxy', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_zrxProxyAddress', - type: 'address', - }, - ], - name: 'setZrxProxy', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'stakingProxyAddress', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'staker', - type: 'address', - }, - ], - name: 'withdrawAllFrom', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'staker', - type: 'address', - }, - { - name: 'amount', - type: 'uint256', - }, - ], - name: 'withdrawFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'zrxAssetProxy', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - /** - * Subscribe to an event type emitted by the ZrxVault contract. - * @param eventName The ZrxVault contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: ZrxVaultEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, ZrxVaultEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - ZrxVaultContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The ZrxVault contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: ZrxVaultEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, ZrxVaultEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - ZrxVaultContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = ZrxVaultContract.deployedBytecode, - ) { - super( - 'ZrxVault', - ZrxVaultContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - ZrxVaultContract.ABI(), - this._web3Wrapper, - ); - } -} - -// tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align -// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts index dd7e6dc95d..be9d79a8bd 100644 --- a/packages/abi-gen-wrappers/src/index.ts +++ b/packages/abi-gen-wrappers/src/index.ts @@ -100,30 +100,6 @@ export { CoordinatorRegistryCoordinatorEndpointSetEventArgs, CoordinatorRegistryContract, } from './generated-wrappers/coordinator_registry'; -export { - ZrxVaultAuthorizedAddressAddedEventArgs, - ZrxVaultAuthorizedAddressRemovedEventArgs, - ZrxVaultContract, - ZrxVaultDepositEventArgs, - ZrxVaultEventArgs, - ZrxVaultEvents, - ZrxVaultInCatastrophicFailureModeEventArgs, - ZrxVaultOwnershipTransferredEventArgs, - ZrxVaultStakingProxySetEventArgs, - ZrxVaultWithdrawEventArgs, - ZrxVaultZrxProxySetEventArgs, -} from './generated-wrappers/zrx_vault'; - -export { - ERC20BridgeProxyAuthorizedAddressAddedEventArgs, - ERC20BridgeProxyAuthorizedAddressRemovedEventArgs, - ERC20BridgeProxyContract, - ERC20BridgeProxyEventArgs, - ERC20BridgeProxyEvents, -} from './generated-wrappers/erc20_bridge_proxy'; - -// Note: No need to export other events as this is a StakingContract with more open constructor args -export { TestStakingContract } from './generated-wrappers/test_staking'; export * from '@0x/contract-addresses'; export { diff --git a/packages/contract-addresses/addresses.json b/packages/contract-addresses/addresses.json index c283d0d5ab..4adf805bb8 100644 --- a/packages/contract-addresses/addresses.json +++ b/packages/contract-addresses/addresses.json @@ -39,7 +39,7 @@ "multiAssetProxy": "0xab8fbd189c569ccdee3a4d929bb7f557be4028f6", "staticCallProxy": "0xe1b97e47aa3796276033a5341e884d2ba46b6ac1", "erc1155Proxy": "0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d", - "devUtils": "0x1f7a9c2e2c25ab1a894af1fd816599860ee2276c", + "devUtils": "0x6bb2fc91a82b55c02b88873958a19e04fbd02090", "zrxVault": "0xffd161026865ad8b4ab28a76840474935eec4dfa", "staking": "0x3f46b98061a3e1e1f41dff296ec19402c298f8a9", "stakingProxy": "0xfaabcee42ab6b9c649794ac6c133711071897ee9", @@ -62,7 +62,7 @@ "multiAssetProxy": "0xb34cde0ad3a83d04abebc0b66e75196f22216621", "staticCallProxy": "0xe1b97e47aa3796276033a5341e884d2ba46b6ac1", "erc1155Proxy": "0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d", - "devUtils": "0xfd21088fb008349839c2209ecbde97a7a4d2e397", + "devUtils": "0x326a303dc0fe20f43acb8e5dec99154e47f32d01", "zrxVault": "0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224", "staking": "0x344d4f661a82afdd84d31456c291822d90d5dc3a", "stakingProxy": "0xc6ad5277ea225ac05e271eb14a7ebb480cd9dd9f", @@ -85,7 +85,7 @@ "multiAssetProxy": "0xf6313a772c222f51c28f2304c0703b8cf5428fd8", "staticCallProxy": "0x48e94bdb9033640d45ea7c721e25f380f8bffa43", "erc1155Proxy": "0x64517fa2b480ba3678a2a3c0cf08ef7fd4fad36f", - "devUtils": "0xa3858baf73430c2fa2339c731e3ffb04ea5e359c", + "devUtils": "0x5078321eec0fd8db5d61d25cce3ea2d6379bb5df", "zrxVault": "0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291", "staking": "0x89150f5eed50b3528f79bfb539f29d727f92821c", "stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34", diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json index c2f6cfd9c7..a24d2e46f1 100644 --- a/packages/contract-artifacts/CHANGELOG.json +++ b/packages/contract-artifacts/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Replace Staking artifact with TestStaking", "pr": 2322 + }, + { + "note": "Added `ZrxVault` and `ERC20BridgeProxy` artifacts", + "pr": 2323 } ] }, diff --git a/packages/contract-artifacts/artifacts/TestStaking.json b/packages/contract-artifacts/artifacts/TestStaking.json deleted file mode 100644 index b093b8f3d0..0000000000 --- a/packages/contract-artifacts/artifacts/TestStaking.json +++ /dev/null @@ -1,844 +0,0 @@ -{ - "schemaVersion": "2.0.0", - "contractName": "TestStaking", - "compilerOutput": { - "abi": [ - { - "inputs": [ - { "internalType": "address", "name": "wethAddress", "type": "address" }, - { "internalType": "address", "name": "zrxVaultAddress", "type": "address" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } - ], - "name": "AuthorizedAddressAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "caller", "type": "address" } - ], - "name": "AuthorizedAddressRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "numPoolsToFinalize", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "rewardsAvailable", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalFeesCollected", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalWeightedStake", "type": "uint256" } - ], - "name": "EpochEnded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "rewardsPaid", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "rewardsRemaining", "type": "uint256" } - ], - "name": "EpochFinalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "exchangeAddress", "type": "address" } - ], - "name": "ExchangeAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "exchangeAddress", "type": "address" } - ], - "name": "ExchangeRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "makerAddress", "type": "address" }, - { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" } - ], - "name": "MakerStakingPoolSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "indexed": false, "internalType": "uint8", "name": "fromStatus", "type": "uint8" }, - { "indexed": true, "internalType": "bytes32", "name": "fromPool", "type": "bytes32" }, - { "indexed": false, "internalType": "uint8", "name": "toStatus", "type": "uint8" }, - { "indexed": true, "internalType": "bytes32", "name": "toPool", "type": "bytes32" } - ], - "name": "MoveStake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, - { "indexed": false, "internalType": "uint32", "name": "oldOperatorShare", "type": "uint32" }, - { "indexed": false, "internalType": "uint32", "name": "newOperatorShare", "type": "uint32" } - ], - "name": "OperatorShareDecreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "epochDurationInSeconds", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "rewardDelegatedStakeWeight", - "type": "uint32" - }, - { "indexed": false, "internalType": "uint256", "name": "minimumPoolStake", "type": "uint256" }, - { - "indexed": false, - "internalType": "uint256", - "name": "cobbDouglasAlphaNumerator", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "cobbDouglasAlphaDenominator", - "type": "uint256" - } - ], - "name": "ParamsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, - { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, - { "indexed": false, "internalType": "uint256", "name": "operatorReward", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "membersReward", "type": "uint256" } - ], - "name": "RewardsPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Stake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, - { "indexed": false, "internalType": "address", "name": "operator", "type": "address" }, - { "indexed": false, "internalType": "uint32", "name": "operatorShare", "type": "uint32" } - ], - "name": "StakingPoolCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "epoch", "type": "uint256" }, - { "indexed": true, "internalType": "bytes32", "name": "poolId", "type": "bytes32" } - ], - "name": "StakingPoolEarnedRewardsInEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Unstake", - "type": "event" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], - "name": "addAuthorizedAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "addr", "type": "address" }], - "name": "addExchangeAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "aggregatedStatsByEpoch", - "outputs": [ - { "internalType": "uint256", "name": "rewardsAvailable", "type": "uint256" }, - { "internalType": "uint256", "name": "numPoolsToFinalize", "type": "uint256" }, - { "internalType": "uint256", "name": "totalFeesCollected", "type": "uint256" }, - { "internalType": "uint256", "name": "totalWeightedStake", "type": "uint256" }, - { "internalType": "uint256", "name": "totalRewardsFinalized", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "authorities", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "authorized", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "cobbDouglasAlphaDenominator", - "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "cobbDouglasAlphaNumerator", - "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, - { "internalType": "address", "name": "member", "type": "address" } - ], - "name": "computeRewardBalanceOfDelegator", - "outputs": [{ "internalType": "uint256", "name": "reward", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "computeRewardBalanceOfOperator", - "outputs": [{ "internalType": "uint256", "name": "reward", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "uint32", "name": "operatorShare", "type": "uint32" }, - { "internalType": "bool", "name": "addOperatorAsMaker", "type": "bool" } - ], - "name": "createStakingPool", - "outputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "currentEpoch", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "currentEpochStartTimeInSeconds", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, - { "internalType": "uint32", "name": "newOperatorShare", "type": "uint32" } - ], - "name": "decreaseStakingPoolOperatorShare", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "endEpoch", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "epochDurationInSeconds", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "finalizePool", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAuthorizedAddresses", - "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getCurrentEpochEarliestEndTimeInSeconds", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "enum IStructs.StakeStatus", "name": "stakeStatus", "type": "uint8" }], - "name": "getGlobalStakeByStatus", - "outputs": [ - { - "components": [ - { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, - { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, - { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } - ], - "internalType": "struct IStructs.StoredBalance", - "name": "balance", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" }, - { "internalType": "enum IStructs.StakeStatus", "name": "stakeStatus", "type": "uint8" } - ], - "name": "getOwnerStakeByStatus", - "outputs": [ - { - "components": [ - { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, - { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, - { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } - ], - "internalType": "struct IStructs.StoredBalance", - "name": "balance", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getParams", - "outputs": [ - { "internalType": "uint256", "name": "_epochDurationInSeconds", "type": "uint256" }, - { "internalType": "uint32", "name": "_rewardDelegatedStakeWeight", "type": "uint32" }, - { "internalType": "uint256", "name": "_minimumPoolStake", "type": "uint256" }, - { "internalType": "uint32", "name": "_cobbDouglasAlphaNumerator", "type": "uint32" }, - { "internalType": "uint32", "name": "_cobbDouglasAlphaDenominator", "type": "uint32" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" }, - { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } - ], - "name": "getStakeDelegatedToPoolByOwner", - "outputs": [ - { - "components": [ - { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, - { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, - { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } - ], - "internalType": "struct IStructs.StoredBalance", - "name": "balance", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "getStakingPool", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "operator", "type": "address" }, - { "internalType": "uint32", "name": "operatorShare", "type": "uint32" } - ], - "internalType": "struct IStructs.Pool", - "name": "", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "getStakingPoolStatsThisEpoch", - "outputs": [ - { - "components": [ - { "internalType": "uint256", "name": "feesCollected", "type": "uint256" }, - { "internalType": "uint256", "name": "weightedStake", "type": "uint256" }, - { "internalType": "uint256", "name": "membersStake", "type": "uint256" } - ], - "internalType": "struct IStructs.PoolStats", - "name": "", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "staker", "type": "address" }], - "name": "getTotalStake", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "getTotalStakeDelegatedToPool", - "outputs": [ - { - "components": [ - { "internalType": "uint64", "name": "currentEpoch", "type": "uint64" }, - { "internalType": "uint96", "name": "currentEpochBalance", "type": "uint96" }, - { "internalType": "uint96", "name": "nextEpochBalance", "type": "uint96" } - ], - "internalType": "struct IStructs.StoredBalance", - "name": "balance", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getWethContract", - "outputs": [{ "internalType": "contract IEtherToken", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getZrxVault", - "outputs": [{ "internalType": "contract IZrxVault", "name": "zrxVault", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "joinStakingPoolAsMaker", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "lastPoolId", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "minimumPoolStake", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "components": [ - { "internalType": "enum IStructs.StakeStatus", "name": "status", "type": "uint8" }, - { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } - ], - "internalType": "struct IStructs.StakeInfo", - "name": "from", - "type": "tuple" - }, - { - "components": [ - { "internalType": "enum IStructs.StakeStatus", "name": "status", "type": "uint8" }, - { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } - ], - "internalType": "struct IStructs.StakeInfo", - "name": "to", - "type": "tuple" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "moveStake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "makerAddress", "type": "address" }, - { "internalType": "address", "name": "payerAddress", "type": "address" }, - { "internalType": "uint256", "name": "protocolFee", "type": "uint256" } - ], - "name": "payProtocolFee", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "poolIdByMaker", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "bytes32", "name": "", "type": "bytes32" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "name": "poolStatsByEpoch", - "outputs": [ - { "internalType": "uint256", "name": "feesCollected", "type": "uint256" }, - { "internalType": "uint256", "name": "weightedStake", "type": "uint256" }, - { "internalType": "uint256", "name": "membersStake", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], - "name": "removeAuthorizedAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "target", "type": "address" }, - { "internalType": "uint256", "name": "index", "type": "uint256" } - ], - "name": "removeAuthorizedAddressAtIndex", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "addr", "type": "address" }], - "name": "removeExchangeAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rewardDelegatedStakeWeight", - "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "rewardsByPoolId", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "uint256", "name": "_epochDurationInSeconds", "type": "uint256" }, - { "internalType": "uint32", "name": "_rewardDelegatedStakeWeight", "type": "uint32" }, - { "internalType": "uint256", "name": "_minimumPoolStake", "type": "uint256" }, - { "internalType": "uint32", "name": "_cobbDouglasAlphaNumerator", "type": "uint32" }, - { "internalType": "uint32", "name": "_cobbDouglasAlphaDenominator", "type": "uint32" } - ], - "name": "setParams", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "wethAddress", "type": "address" }], - "name": "setWethContract", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "zrxVaultAddress", "type": "address" }], - "name": "setZrxVault", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "stake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "stakingContract", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "testWethAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "testZrxVaultAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "unstake", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "validExchanges", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "wethReservedForPoolRewards", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "bytes32", "name": "poolId", "type": "bytes32" }], - "name": "withdrawDelegatorRewards", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "evm": { - "bytecode": { - "object": "0x60806040523480156200001157600080fd5b50604051620059be380380620059be833981016040819052620000349162000071565b600080546001600160a01b03199081163317909155601880546001600160a01b0394851690831617905560198054929093169116179055620000c8565b6000806040838503121562000084578182fd5b82516200009181620000af565b6020840151909250620000a481620000af565b809150509250929050565b6001600160a01b0381168114620000c557600080fd5b50565b6158e680620000d86000396000f3fe6080604052600436106103555760003560e01c80639051c3ee116101bb578063bb7ef7e0116100f7578063e8eeb3f811610095578063f18765321161006f578063f187653214610955578063f252b7a114610975578063f2fde38b14610995578063ff691b11146109b557610355565b8063e8eeb3f81461090b578063e907f00314610920578063ee99205c1461094057610355565b8063dcb31f76116100d1578063dcb31f76146108ac578063e0ee036e146108c1578063e1c7392a146108d6578063e804d0a4146108eb57610355565b8063bb7ef7e01461084a578063c18c91411461086a578063d39de6e91461088a57610355565b8063a694fc3a11610164578063b2baa33e1161013e578063b2baa33e146107d5578063b3e33379146107ea578063b510879f1461080a578063b91816111461082a57610355565b8063a694fc3a14610780578063abe0906a146107a0578063b0531524146107c057610355565b8063a26171e211610195578063a26171e214610743578063a3b4a32714610758578063a657e5791461076b57610355565b80639051c3ee146106ee5780639ad26744146107035780639c3ccc821461072357610355565b80634e67339f116102955780636340380111610233578063766718081161020d578063766718081461068257806381666796146106975780638a2e271a146106b95780638da5cb5b146106d957610355565b8063634038011461062d57806368a7d6cd14610642578063707129391461066257610355565b80635bd4ab731161026f5780635bd4ab73146105a55780635d91121d146105d25780635e615a6b146105f2578063624a72321461061857610355565b80634e67339f14610550578063587da0231461057057806358f6c7e31461058557610355565b80633c277fc51161030257806344a6958b116102dc57806344a6958b146104b657806346b97959146104d6578063494503d4146105035780634bcc3f671461052357610355565b80633c277fc5146104475780633e4ad7321461046957806342f1181e1461049657610355565b80632a94c279116103335780632a94c279146103c75780632e17de78146103f657806338229d931461041657610355565b806301e28d841461035a5780630b9663db1461037c5780631e7ff8f6146103a7575b600080fd5b34801561036657600080fd5b5061037a6103753660046151e2565b6109d5565b005b34801561038857600080fd5b50610391610aa3565b60405161039e9190615561565b60405180910390f35b3480156103b357600080fd5b506103916103c23660046151e2565b610bf0565b3480156103d357600080fd5b506103e76103e2366004615315565b610c8a565b60405161039e9392919061574e565b34801561040257600080fd5b5061037a6104113660046152d9565b610cb6565b34801561042257600080fd5b506104366104313660046152d9565b610e6b565b60405161039e95949392919061577f565b34801561045357600080fd5b5061045c610e9a565b60405161039e919061545e565b34801561047557600080fd5b506104896104843660046152d9565b610f43565b60405161039e919061570f565b3480156104a257600080fd5b5061037a6104b13660046151e2565b610f62565b3480156104c257600080fd5b506104896104d1366004615285565b610f76565b3480156104e257600080fd5b506104f66104f13660046152d9565b610fd5565b60405161039e91906156bb565b34801561050f57600080fd5b5061045c61051e3660046152d9565b611020565b34801561052f57600080fd5b5061054361053e3660046152d9565b611054565b60405161039e91906156dc565b34801561055c57600080fd5b5061037a61056b3660046151e2565b6110b6565b34801561057c57600080fd5b506103916110fd565b34801561059157600080fd5b5061037a6105a036600461537e565b611103565b3480156105b157600080fd5b506105c56105c03660046151e2565b611300565b60405161039e9190615556565b3480156105de57600080fd5b5061037a6105ed366004615336565b611315565b3480156105fe57600080fd5b506106076113de565b60405161039e9594939291906157a2565b34801561062457600080fd5b5061045c611407565b34801561063957600080fd5b50610391611472565b34801561064e57600080fd5b5061039161065d366004615431565b611478565b34801561066e57600080fd5b5061037a61067d3660046151e2565b6115b1565b34801561068e57600080fd5b50610391611666565b3480156106a357600080fd5b506106ac61166c565b60405161039e91906157e6565b3480156106c557600080fd5b5061037a6106d43660046151e2565b611678565b3480156106e557600080fd5b5061045c61173a565b3480156106fa57600080fd5b5061045c611756565b34801561070f57600080fd5b5061037a61071e36600461525a565b611772565b34801561072f57600080fd5b5061037a61073e3660046153d3565b611784565b34801561074f57600080fd5b506103916117fe565b61037a61076636600461521a565b611804565b34801561077757600080fd5b50610391611a54565b34801561078c57600080fd5b5061037a61079b3660046152d9565b611a5a565b3480156107ac57600080fd5b5061037a6107bb3660046151e2565b611b6f565b3480156107cc57600080fd5b50610391611bb6565b3480156107e157600080fd5b50610391611bbc565b3480156107f657600080fd5b5061037a6108053660046152d9565b611bda565b34801561081657600080fd5b5061037a6108253660046152d9565b611c1a565b34801561083657600080fd5b506105c56108453660046151e2565b611c24565b34801561085657600080fd5b506103916108653660046152d9565b611c39565b34801561087657600080fd5b506103916108853660046152d9565b611cc4565b34801561089657600080fd5b5061089f611cd6565b60405161039e91906154fd565b3480156108b857600080fd5b5061045c611d45565b3480156108cd57600080fd5b506106ac611d61565b3480156108e257600080fd5b5061037a611d6d565b3480156108f757600080fd5b50610489610906366004615362565b611d87565b34801561091757600080fd5b506106ac611ed7565b34801561092c57600080fd5b5061039161093b3660046152f1565b611eeb565b34801561094c57600080fd5b5061045c611f88565b34801561096157600080fd5b506103916109703660046151e2565b611fa4565b34801561098157600080fd5b5061048961099036600461525a565b611fb6565b3480156109a157600080fd5b5061037a6109b03660046151e2565b611ff7565b3480156109c157600080fd5b5061037a6109d03660046152d9565b61209a565b6109dd6122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16610a1d57610a1d610a186001836122ea565b61238c565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517ff50d0d312d501878616eb5e78ebf3ed6dcd3955aaef8165af9c6b057cc4832fb90610a9890839061545e565b60405180910390a150565b600c5460009081610abb82600163ffffffff61239416565b6000818152601660205260409020600101549091508015610ae357610ae3610a1883836123b3565b610aeb6123d0565b610af3612443565b600084815260166020526040902055610b0a6150ee565b50600083815260166020908152604091829020825160a08101845281548082526001830154938201849052600283015482860181905260038401546060840181905260049094015460808401529451919488947fbb4a26fa0ace13ee4da343896c20eaa44a618fb9071fdd8c2e2c960a4583189d94610b8c9491939291615764565b60405180910390a2610b9c6124e7565b6020810151610be357805160405185917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b291610bda916000916155ac565b60405180910390a25b6020015193505050505b90565b6000610bfa611407565b73ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401610c32919061545e565b60206040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c8291908101906153bb565b90505b919050565b601560209081526000928352604080842090915290825290208054600182015460029092015490919083565b33610cbf61511d565b73ffffffffffffffffffffffffffffffffffffffff821660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610d0c9061252a565b90506000610d3e82602001516bffffffffffffffffffffffff1683604001516bffffffffffffffffffffffff166125d0565b905080841115610d5557610d55610a1885836125e6565b73ffffffffffffffffffffffffffffffffffffffff831660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610da39085612603565b610dab611407565b73ffffffffffffffffffffffffffffffffffffffff16639470b0bd84866040518363ffffffff1660e01b8152600401610de59291906154d7565b600060405180830381600087803b158015610dff57600080fd5b505af1158015610e13573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd85604051610e5d9190615561565b60405180910390a250505050565b601660205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcb31f766040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f3d91908101906151fe565b91505090565b610f4b61511d565b6000828152600760205260409020610c829061252a565b610f6a61268a565b610f73816126d1565b50565b610f7e61511d565b610fcc60056000846001811115610f9157fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff88168252909252902061252a565b90505b92915050565b610fdd61513d565b506000908152601560209081526040808320600c548452825291829020825160608101845281548152600182015492810192909252600201549181019190915290565b6002818154811061102d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61105c61515e565b506000908152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff169082015290565b601980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5481565b338161110f57506112fb565b600061111e6020860186615362565b600181111561112957fe5b14801561114d575060006111406020850185615362565b600181111561114b57fe5b145b1561115857506112fb565b60016111676020860186615362565b600181111561117257fe5b14156111875761118784602001358284612802565b60016111966020850185615362565b60018111156111a157fe5b14156111b6576111b68360200135828461289b565b60006005816111c86020880188615362565b60018111156111d357fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff861682528352908120925090600590829061121d90880188615362565b600181111561122857fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff871682529092529020905061126b828286612934565b60208086013590870180359073ffffffffffffffffffffffffffffffffffffffff8616907f7d3ad1dcf03b9027064d1d9a474a69e0cecc31324c541d3eb9b5e6fa2f106c8d9088906112bd908c615362565b60018111156112c857fe5b6112d560208c018c615362565b60018111156112e057fe5b6040516112ef939291906157cd565b60405180910390a45050505b505050565b60106020526000908152604090205460ff1681565b8161131f81612a2d565b6000838152600a602052604090205474010000000000000000000000000000000000000000900463ffffffff16611357848285612a66565b6000848152600a60205260409081902080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8716021790555184907f8ea2a7a959bd25f226b7b0a4393613f7fdcaa8404e8bad96aa52dc1c1459016790610e5d90849087906157f7565b601154601254601354601454929363ffffffff9283169391928281169264010000000090041690565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639051c3ee6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b60115481565b600854600090339061149190600163ffffffff612aad16565b600881905591506114a682620f424086612a66565b6114ae61515e565b5060408051808201825273ffffffffffffffffffffffffffffffffffffffff838116825263ffffffff87811660208085019182526000888152600a9091528590208451815492517fffffffffffffffffffffffff00000000000000000000000000000000000000009093169416939093177fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000919092160217905590517fcec6fc86ea644053f6edff1160dfe3fa5c61e7a5ef9f873f145bb03a0bd319e7906115929085908590899061556a565b60405180910390a183156115a9576115a983611bda565b505092915050565b6115b961268a565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166115f2576115f2610a1882612ac9565b60005b600254811015611662578173ffffffffffffffffffffffffffffffffffffffff166002828154811061162357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561165a576116558282612b68565b611662565b6001016115f5565b5050565b600c5481565b60145463ffffffff1681565b6116806122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16156116bc576116bc610a186000836122ea565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f3e535d1ab441ef41c268fd9b52b478aee02d693c5ca2a84b5d26b89e0922e5e190610a9890839061545e565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60195473ffffffffffffffffffffffffffffffffffffffff1681565b61177a61268a565b6116628282612b68565b61178c6122c7565b6117998585858585612db7565b3073ffffffffffffffffffffffffffffffffffffffff1663c6f3a4276040518163ffffffff1660e01b815260040160006040518083038186803b1580156117df57600080fd5b505afa1580156117f3573d6000803e3d6000fd5b505050505050505050565b60135481565b3360009081526010602052604090205460ff1661182757611827610a1833612e7a565b61183081612e95565b3461190a5761183d610e9a565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd8330846040518463ffffffff1660e01b8152600401611879939291906154a6565b602060405180830381600087803b15801561189357600080fd5b505af11580156118a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118cb91908101906152bd565b61190a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190190615684565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152600960205260409020548061193b57506112fb565b600061194682610f43565b602001516bffffffffffffffffffffffff16905060135481101561196b5750506112fb565b600c54600083815260156020908152604080832084845282528083206016909252909120815480611a1a576000806119a38888612eb6565b6002870182905560018701819055600386015491935091506119cb908263ffffffff612aad16565b60038501556001808501546119e59163ffffffff612aad16565b6001850155604051889087907f14b098103235344975b17508c2391721cc9ac3f3fa2b56c7ff46f8480dfd074f90600090a350505b611a2a818863ffffffff612aad16565b83556002820154611a41908863ffffffff612aad16565b8260020181905550505050505050505050565b60085481565b33611a63611407565b73ffffffffffffffffffffffffffffffffffffffff166315cc36f282846040518363ffffffff1660e01b8152600401611a9d9291906154d7565b600060405180830381600087803b158015611ab757600080fd5b505af1158015611acb573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff811660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020611b1d9083612f42565b8073ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a83604051611b639190615561565b60405180910390a25050565b601880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60175481565b6000611bd5601154600d54612aad90919063ffffffff16565b905090565b3360008181526009602052604080822084905551839183917f5640833634fce74eb9211d1209a91dd5a1c8c6a751696bff9323b4db67f815139190a35050565b610f738133612fac565b60016020526000908152604090205460ff1681565b6000611c4361515e565b506000828152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611ca785613184565b91509150611cba83602001518383613241565b5095945050505050565b600b6020526000908152604090205481565b60606002805480602002602001604051908101604052809291908181526020018280548015611d3b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611d10575b5050505050905090565b60185473ffffffffffffffffffffffffffffffffffffffff1681565b60125463ffffffff1681565b611d756122c7565b611d7d613282565b611d85613295565b565b611d8f61511d565b60016000526004602052611dc27fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0561252a565b90506000826001811115611dd257fe5b1415610c85576000611de2611407565b73ffffffffffffffffffffffffffffffffffffffff16639706e0c06040518163ffffffff1660e01b815260040160206040518083038186803b158015611e2757600080fd5b505afa158015611e3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e5f91908101906153bb565b9050611e8e611e8983602001516bffffffffffffffffffffffff168361239490919063ffffffff16565b6132c0565b6bffffffffffffffffffffffff90811660208401526040830151611ebe91611e899184911663ffffffff61239416565b6bffffffffffffffffffffffff16604083015250919050565b601454640100000000900463ffffffff1681565b6000611ef561515e565b506000838152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611f5986613184565b915091506000611f6e84602001518484613241565b915050611f7d878783856132e4565b979650505050505050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60096020526000908152604090205481565b611fbe61511d565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602090815260408083208584529091529020610fcc9061252a565b611fff61268a565b73ffffffffffffffffffffffffffffffffffffffff811661202a57612025610a18613431565b610f73565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600c5460006120b082600163ffffffff61239416565b90506120ba6150ee565b50600081815260166020908152604091829020825160a0810184528154815260018201549281018390526002820154938101939093526003810154606084015260040154608083015261210f57505050610f73565b61211761513d565b50600084815260156020908152604080832085845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526121655750505050610f73565b60008581526015602090815260408083208684529091528120818155600181018290556002018190556121988284613468565b90506000806121ac888486604001516134dd565b9150915087877ff1116b309178aa62dcb6bf8c3b8bc2321724907c7ebf52192d14c8ce3aa9194c84846040516121e39291906155ac565b60405180910390a360006121fd838363ffffffff612aad16565b6080870151909150612215908263ffffffff612aad16565b6080870181905260008881526016602090815260409091206004019190915586015161224890600163ffffffff61239416565b602080880182815260008a81526016909252604090912060010191909155516117f3576080860151865188917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b2916122a6908263ffffffff61239416565b6040516122b49291906155ac565b60405180910390a2505050505050505050565b3360009081526001602052604090205460ff16611d8557611d85610a183361362d565b606063b9588e4360e01b83836040516024016123079291906155f4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b6000828211156123ad576123ad610a1860028585613648565b50900390565b606063614b800a60e01b83836040516024016123079291906155ac565b30318015610f73576123e0610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561242757600080fd5b505af115801561243b573d6000803e3d6000fd5b505050505050565b6000611bd5601754612453610e9a565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161248b919061545e565b60206040518083038186803b1580156124a357600080fd5b505afa1580156124b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506124db91908101906153bb565b9063ffffffff61239416565b4260006124f2611bbc565b90508181111561250957612509610a1882846136ed565b600c5460009061252090600163ffffffff612aad16565b600c555050600d55565b61253261511d565b5060408051606081018252825467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811660208501527401000000000000000000000000000000000000000090920490911692820192909252600c5490918111156125ca576125a58161370a565b67ffffffffffffffff16825260408201516bffffffffffffffffffffffff1660208301525b50919050565b60008183106125df5781610fcc565b5090919050565b60606384c8b7c960e01b83836040516024016123079291906155ac565b61260b61511d565b6126148361252a565b905061263e611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff61239416565b6bffffffffffffffffffffffff1660208201526112fb838261372a565b60005473ffffffffffffffffffffffffffffffffffffffff163314611d8557600054611d8590610a1890339073ffffffffffffffffffffffffffffffffffffffff166137e4565b73ffffffffffffffffffffffffffffffffffffffff81166126f7576126f7610a18613801565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561273157612731610a1882613838565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b61280b83613853565b6128158383612fac565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600660209081526040808320868452909152902061284f908261388a565b6000838152600760205260409020612867908261388a565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe058261388a565b6128a483613853565b6128ae8383612fac565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260066020908152604080832086845290915290206128e890826138e2565b600083815260076020526040902061290090826138e2565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05826138e2565b61293e838361391d565b15612948576112fb565b61295061511d565b6129598461252a565b905061296361511d565b61296c8461252a565b905081604001516bffffffffffffffffffffffff168311156129a7576129a7610a188484604001516bffffffffffffffffffffffff166125e6565b60408201516129ce90611e89906bffffffffffffffffffffffff168563ffffffff61239416565b6bffffffffffffffffffffffff9081166040808501919091528201516129ff91611e8991168563ffffffff612aad16565b6bffffffffffffffffffffffff166040820152612a1c858361372a565b612a26848261372a565b5050505050565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff1633811461166257611662610a183384613924565b620f424063ffffffff82161115612a8b57612a86610a1860008584613941565b6112fb565b8163ffffffff168163ffffffff16106112fb576112fb610a1860018584613941565b600082820183811015610fcc57610fcc610a1860008686613648565b606063eb5108a260e01b82604051602401612ae4919061545e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16612ba157612ba1610a1883612ac9565b6002548110612bbc57612bbc610a1882600280549050613960565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110612be057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614612c4257612c42610a1860028381548110612c1a57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff168461397d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110612cbd57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110612cf057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190612d6f9082615175565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60118590556012805463ffffffff8087167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000092831617909255601385905560148054848416640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff9487169190931617929092161790556040517f613157dbb0e920deab8ad6ddd3805e87cbf57344b9fe780f1764790ec789754290612e6b90879087908790879087906157a2565b60405180910390a15050505050565b606063b56d2df060e01b82604051602401612ae4919061545e565b803414158015612ea457503415155b15610f7357610f73610a18823461399a565b6000828152600a602052604081205481908190612ee99073ffffffffffffffffffffffffffffffffffffffff1686611fb6565b602001516bffffffffffffffffffffffff169050612f0d848263ffffffff61239416565b601254909350612f3890612f2b9063ffffffff16620f4240866139b7565b829063ffffffff612aad16565b9150509250929050565b612f4a61511d565b612f538361252a565b9050612f7d611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff612aad16565b612fb5826139d9565b6000612fc483836000806132e4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832087845290915290209091506130009061252a565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600660209081526040808320888452825291829020845181549286015195909301517fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090921667ffffffffffffffff909316929092177fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff16680100000000000000006bffffffffffffffffffffffff9586160217909216740100000000000000000000000000000000000000009390921692909202179055801561317b576130e58382613a4d565b6130ed610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016131279291906154d7565b602060405180830381600087803b15801561314157600080fd5b505af1158015613155573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061317991908101906152bd565b505b6112fb83613a95565b600080600061319f6001600c5461239490919063ffffffff16565b90506131a961513d565b50600084815260156020908152604080832084845282528083208151606080820184528254825260018084015483870152600293840154838601528787526016865295849020845160a0810186528154815296810154958701959095529184015492850192909252600383015490840152600490910154608083015290613231908290613468565b9350806040015192505050915091565b600080826132515783915061327a565b61326563ffffffff8616620f424086613aa2565b9150613277848363ffffffff61239416565b90505b935093915050565b61328a613ad8565b42600d556001600c55565b61329d613aed565b620d2f00620dbba068056bc75e2d6310000060026003612a268585858585612db7565b806bffffffffffffffffffffffff81168114610c8557610c85610a18600284613b52565b600c546000906132f261511d565b5073ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083208984528252918290208251606081018452905467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811694840194909452740100000000000000000000000000000000000000009091049092169281019290925282141561339357600092505050613429565b61339f81838787613b6f565b81519093506000906133c29067ffffffffffffffff16600163ffffffff612aad16565b90506134006133f38984602001516bffffffffffffffffffffffff16856000015167ffffffffffffffff1685613bf2565b859063ffffffff612aad16565b93506134236133f38984604001516bffffffffffffffffffffffff168487613bf2565b93505050505b949350505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b815160009061347657610fcf565b815183516040840151602086015160608601516014546134ac95949392919063ffffffff80821691640100000000900416613c8b565b608083015183519192506000916134c89163ffffffff61239416565b9050818110156134d6578091505b5092915050565b6000806134e861515e565b506000858152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff1690820181905261354c908686613241565b909350915082156136095761355f610e9a565b81516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092169163a9059cbb916135b59187906004016154d7565b602060405180830381600087803b1580156135cf57600080fd5b505af11580156135e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061360791908101906152bd565b505b8115613624576136198683613d4e565b613624868386613d8f565b50935093915050565b606063b65a25b960e01b82604051602401612ae4919061545e565b606063e946c1bb60e01b848484604051602401613667939291906155ba565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063a6bcde4760e01b83836040516024016123079291906155ac565b8067ffffffffffffffff81168114610c8557610c85610a18600184613b52565b8051825460408301516020909301516bffffffffffffffffffffffff90811668010000000000000000027fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff91909416740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff9094167fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090931692909217929092161716179055565b6060631de45ad160e01b838360405160240161230792919061547f565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b82604051602401612ae4919061545e565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f7357610f73610a18826000613e78565b61389261511d565b61389b8361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff1660408201526112fb838261372a565b6138ea61511d565b6138f38361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b1460011690565b60606382ded78560e01b83836040516024016123079291906154d7565b60606322df959760e01b84848460405160240161366793929190615626565b606063e9f8377160e01b83836040516024016123079291906155ac565b606063140a84db60e01b838360405160240161230792919061547f565b60606331d7a50560e01b83836040516024016123079291906155ac565b6000613429836139cd868563ffffffff613e9516565b9063ffffffff613ec616565b600c546000906139f090600163ffffffff61239416565b90506139fa61513d565b5060008281526015602090815260408083208484528252918290208251606081018452815480825260018301549382019390935260029091015492810192909252156112fb576112fb610a188484613ef0565b6000828152600b6020526040902054613a6c908263ffffffff61239416565b6000838152600b6020526040902055601754613a8e908263ffffffff61239416565b6017555050565b610f738160006001613d8f565b6000613429836139cd613abc82600163ffffffff61239416565b613acc888763ffffffff613e9516565b9063ffffffff612aad16565b600d5415611d8557611d85610a186000613f0d565b60115415801590613b05575060125463ffffffff1615155b8015613b12575060135415155b8015613b25575060145463ffffffff1615155b8015613b405750601454640100000000900463ffffffff1615155b15611d8557611d85610a186001613f0d565b606063c996af7b60e01b83836040516024016123079291906155dc565b6000821580613b7c575081155b15613b8957506000613429565b6000613b9c85600163ffffffff61239416565b865167ffffffffffffffff161015613bb8578560400151613bbe565b85602001515b6bffffffffffffffffffffffff16905080613bdd576000915050613429565b613be88484836139b7565b9695505050505050565b6000831580613c0057508183145b15613c0d57506000613429565b818310613c46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119019061564d565b613c4e615199565b613c588685613f4c565b9050613c62615199565b613c6c8785613f4c565b9050611f7d81600001518260200151846000015185602001518a61406a565b600080613c9888886140f6565b90506000613ca687876140f6565b9050811580613cb3575080155b15613cc4575060009150611f7d9050565b600081831315613cdd57613cd88284614148565b613ce7565b613ce78383614148565b9050613d10613d0b613cf883614167565b8863ffffffff168863ffffffff16614809565b614818565b905081831315613d2957613d248282614148565b613d33565b613d338282614e02565b9050613d3f818c614e2e565b9b9a5050505050505050505050565b6000828152600b6020526040902054613d6d908263ffffffff612aad16565b6000838152600b6020526040902055601754613a8e908263ffffffff612aad16565b6000838152600f6020526040902054600c5480821415613db05750506112fb565b613db8615199565b506000858152600e602090815260408083208584528252918290208251808401909352805483526001015490820152613def615199565b613df882614e70565b15613e3157613e11826000015183602001518888614e79565b60208301819052818352613e259190614edb565b60208301528152613e3c565b602081018590528581525b6000878152600e6020908152604080832086845282528083208451815593820151600190940193909355978152600f9097529095205550505050565b6060639ae94f0160e01b838360405160240161230792919061559c565b600082613ea457506000610fcf565b82820282848281613eb157fe5b0414610fcc57610fcc610a1860018686613648565b600081613edc57613edc610a1860038585613648565b6000828481613ee757fe5b04949350505050565b6060635caa0b0560e01b83836040516024016123079291906155ac565b60607f0b02d77300000000000000000000000000000000000000000000000000000000826001811115613f3c57fe5b604051602401612ae4919061580e565b613f54615199565b506000828152600e602090815260408083208484528252918290208251808401909352805483526001015490820152613f8c81614e70565b15613f9657610fcf565b6000613fa983600163ffffffff61239416565b6000858152600e60209081526040808320848452825291829020825180840190935280548352600101549082015292509050613fe482614e70565b15613fef5750610fcf565b6000848152600f60205260409020548381101561404c576000858152600e602090815260408083208484528252918290208251808401909352805483526001015490820152925061403f83614e70565b1561404c5750610fcf9050565b50506040805180820190915260008152600160208201529392505050565b600081614079575060006140ed565b8361409957614092856139cd848963ffffffff613e9516565b90506140ed565b60006140be6140ae868863ffffffff613e9516565b6124db898763ffffffff613e9516565b905060006140d2828663ffffffff613ec616565b90506140e8876139cd868463ffffffff613e9516565b925050505b95945050505050565b60008083121561410e5761410e610a18600185614f04565b600082121561412557614125610a18600184614f04565b610fcc614142846f80000000000000000000000000000000614f45565b83614f8d565b6000610fcc614142846f80000000000000000000000000000000614f45565b60006f8000000000000000000000000000000082131561418f5761418f610a1860018461500e565b600082136141a5576141a5610a1860008461500e565b6f800000000000000000000000000000008214156141c557506000610c85565b640733048c5a82136141f857507fffffffffffffffffffffffffffffffe010000000000000000000000000000000610c85565b60008060006a01c8464f761647600000008513614257577ffffffffffffffffffffffffffffffff000000000000000000000000000000000909301926a01c8464f761647600000006f8000000000000000000000000000000086020594505b6cf1aaddd7742e9000000000000085136142b5577ffffffffffffffffffffffffffffffff800000000000000000000000000000000909301926cf1aaddd7742e900000000000006f8000000000000000000000000000000086020594505b6e0afe10820813d780000000000000008513614317577ffffffffffffffffffffffffffffffffc00000000000000000000000000000000909301926e0afe10820813d780000000000000006f8000000000000000000000000000000086020594505b6f02582ab704279ec00000000000000000851361437b577ffffffffffffffffffffffffffffffffe00000000000000000000000000000000909301926f02582ab704279ec000000000000000006f8000000000000000000000000000000086020594505b6f1152aaa3bf81cc00000000000000000085136143df577fffffffffffffffffffffffffffffffff00000000000000000000000000000000909301926f1152aaa3bf81cc0000000000000000006f8000000000000000000000000000000086020594505b6f2f16ac6c59de700000000000000000008513614443577fffffffffffffffffffffffffffffffff80000000000000000000000000000000909301926f2f16ac6c59de700000000000000000006f8000000000000000000000000000000086020594505b6f4da2cbf1be582800000000000000000085136144a7577fffffffffffffffffffffffffffffffffc0000000000000000000000000000000909301926f4da2cbf1be58280000000000000000006f8000000000000000000000000000000086020594505b6f63afbe7ab2082c000000000000000000851361450b577fffffffffffffffffffffffffffffffffe0000000000000000000000000000000909301926f63afbe7ab2082c0000000000000000006f8000000000000000000000000000000086020594505b6f70f5a893b608861e1f58934f97aea57d851361456f577ffffffffffffffffffffffffffffffffff0000000000000000000000000000000909301926f70f5a893b608861e1f58934f97aea57d6f8000000000000000000000000000000086020594505b7fffffffffffffffffffffffffffffffff80000000000000000000000000000000850192508291506f80000000000000000000000000000000828002059050700100000000000000000000000000000000838103830205840193506f80000000000000000000000000000000818302816145e557fe5b059150700200000000000000000000000000000000836faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0383028161461657fe5b05840193506f800000000000000000000000000000008183028161463657fe5b059150700300000000000000000000000000000000836f999999999999999999999999999999990383028161466757fe5b05840193506f800000000000000000000000000000008183028161468757fe5b059150700400000000000000000000000000000000836f92492492492492492492492492492492038302816146b857fe5b05840193506f80000000000000000000000000000000818302816146d857fe5b059150700500000000000000000000000000000000836f8e38e38e38e38e38e38e38e38e38e38e0383028161470957fe5b05840193506f800000000000000000000000000000008183028161472957fe5b059150700600000000000000000000000000000000836f8ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b0383028161475a57fe5b05840193506f800000000000000000000000000000008183028161477a57fe5b059150700700000000000000000000000000000000836f89d89d89d89d89d89d89d89d89d89d89038302816147ab57fe5b05840193506f80000000000000000000000000000000818302816147cb57fe5b059150700800000000000000000000000000000000836f88888888888888888888888888888888038302816147fc57fe5b0584019350505050919050565b60006134296141428585614f45565b60007fffffffffffffffffffffffffffffffe01000000000000000000000000000000082121561484a57506000610c85565b8161486657506f80000000000000000000000000000000610c85565b600082131561487d5761487d610a1860018461500e565b6f800000000000000000000000000000006f1000000000000000000000000000000083078080028290056710e1b3be415a0000810293909301929091818302059050806705a0913f6b1e000002830192506f80000000000000000000000000000000828202816148e957fe5b05905080670168244fdac7800002830192506f800000000000000000000000000000008282028161491657fe5b05905080664807432bc1800002830192506f800000000000000000000000000000008282028161494257fe5b05905080660c0135dca0400002830192506f800000000000000000000000000000008282028161496e57fe5b059050806601b707b1cdc00002830192506f800000000000000000000000000000008282028161499a57fe5b059050806536e0f639b80002830192506f80000000000000000000000000000000828202816149c557fe5b05905080650618fee9f80002830192506f80000000000000000000000000000000828202816149f057fe5b05905080649c197dcc0002830192506f8000000000000000000000000000000082820281614a1a57fe5b05905080640e30dce40002830192506f8000000000000000000000000000000082820281614a4457fe5b0590508064012ebd130002830192506f8000000000000000000000000000000082820281614a6e57fe5b059050806317499f0002830192506f8000000000000000000000000000000082820281614a9757fe5b059050806301a9d48002830192506f8000000000000000000000000000000082820281614ac057fe5b05905080621c638002830192506f8000000000000000000000000000000082820281614ae857fe5b059050806201c63802830192506f8000000000000000000000000000000082820281614b1057fe5b05905080611ab802830192506f8000000000000000000000000000000082820281614b3757fe5b0590508061017c02830192506f8000000000000000000000000000000082820281614b5e57fe5b05905080601402830192506f8000000000000000000000000000000082820281614b8457fe5b600095909503946721c3677c82b400009190059384010582016f8000000000000000000000000000000001929050701000000000000000000000000000000000841615614bf3577243cbaf42a000812488fc5c220ad7b97bf6e99e6cf1aaddd7742e56d32fb9f9974484020592505b700800000000000000000000000000000000841615614c35577105d27a9f51c31b7c2f8038212a05747799916e0afe10820813d65dfe6a33c07f738f84020592505b700400000000000000000000000000000000841615614c7757701b4c902e273a58678d6d3bfdb93db96d026f02582ab704279e8efd15e0265855c47a84020592505b700200000000000000000000000000000000841615614cb9577003b1cc971a9bb5b9867477440d6d1577506f1152aaa3bf81cb9fdb76eae12d02957184020592505b700100000000000000000000000000000000841615614cfb5770015bf0a8b1457695355fb8ac404e7a79e36f2f16ac6c59de6f8d5d6f63c1482a7c8684020592505b6f80000000000000000000000000000000841615614d3b576fd3094c70f034de4b96ff7d5b6f99fcd86f4da2cbf1be5827f9eb3ad1aa9866ebb384020592505b6f40000000000000000000000000000000841615614d7b576fa45af1e1f40c333b3de1db4dd55f29a76f63afbe7ab2082ba1a0ae5e4eb1b479dc84020592505b6f20000000000000000000000000000000841615614dbb576f910b022db7ae67ce76b441c27035c6a16f70f5a893b608861e1f58934f97aea57d84020592505b6f10000000000000000000000000000000841615614dfb576f88415abbe9a76bead8d00cf112e4d4a86f783eafef1c0a8f3978c7f81824d62ebf84020592505b5050919050565b60006f80000000000000000000000000000000614e1f8484614f45565b81614e2657fe5b059392505050565b600080821215614e4657614e46610a18600184614f04565b6000614e528484614f45565b905060008113614e66576000915050610fcf565b607f1c9392505050565b60200151151590565b60008085614e8b575082905081614ed2565b83614e9a575084905083614ed2565b614ebd614ead858763ffffffff613e9516565b613acc888663ffffffff613e9516565b9150614ecf858463ffffffff613e9516565b90505b94509492505050565b600080614ef984846f8000000000000000000000000000000061503d565b915091509250929050565b60607fbd79545f00000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b8360405160240161230792919061581c565b600082614f5457506000610fcf565b5081810281838281614f6257fe5b05141580614f79575082828281614f7557fe5b0514155b15610fcf57610fcf610a18600185856150ab565b600081614fa357614fa3610a18600285856150ab565b7f800000000000000000000000000000000000000000000000000000000000000083148015614ff15750817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff145b1561500557615005610a18600385856150ab565b818381614e2657fe5b60607fed2f26a100000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b6000808285118061504d57508284115b156150a2576000848610156150625784615064565b855b9050615076818563ffffffff613ec616565b9050615088868263ffffffff613ec616565b925061509a858263ffffffff613ec616565b91505061327a565b50929391925050565b60607f8c12dfe7000000000000000000000000000000000000000000000000000000008460038111156150da57fe5b84846040516024016136679392919061582f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180606001604052806000815260200160008152602001600081525090565b604080518082019091526000808252602082015290565b8154818355818111156112fb576000838152602090206112fb9181019083016151b3565b604051806040016040528060008152602001600081525090565b610bed91905b808211156151cd57600081556001016151b9565b5090565b6000604082840312156125ca578081fd5b6000602082840312156151f3578081fd5b8135610fcc81615854565b60006020828403121561520f578081fd5b8151610fcc81615854565b60008060006060848603121561522e578182fd5b833561523981615854565b9250602084013561524981615854565b929592945050506040919091013590565b6000806040838503121561526c578182fd5b823561527781615854565b946020939093013593505050565b60008060408385031215615297578182fd5b82356152a281615854565b915060208301356152b281615884565b809150509250929050565b6000602082840312156152ce578081fd5b8151610fcc81615876565b6000602082840312156152ea578081fd5b5035919050565b60008060408385031215615303578182fd5b8235915060208301356152b281615854565b60008060408385031215615327578182fd5b50508035926020909101359150565b60008060408385031215615348578182fd5b82359150602083013563ffffffff811681146152b2578182fd5b600060208284031215615373578081fd5b8135610fcc81615884565b600080600060a08486031215615392578283fd5b61539c85856151d1565b92506153ab85604086016151d1565b9150608084013590509250925092565b6000602082840312156153cc578081fd5b5051919050565b600080600080600060a086880312156153ea578283fd5b8535945060208601356153fc81615891565b935060408601359250606086013561541381615891565b9150608086013561542381615891565b809150509295509295909350565b60008060408385031215615443578182fd5b823561544e81615891565b915060208301356152b281615876565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000918401906040840190835b8181101561554b57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101615517565b509095945050505050565b901515815260200190565b90815260200190565b92835273ffffffffffffffffffffffffffffffffffffffff91909116602083015263ffffffff16604082015260600190565b9182521515602082015260400190565b918252602082015260400190565b60608101600485106155c857fe5b938152602081019290925260409091015290565b60408101600384106155ea57fe5b9281526020015290565b604081016156018461584a565b92815273ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b606081016156338561584a565b938152602081019290925263ffffffff1660409091015290565b60208082526013908201527f43525f494e54455256414c5f494e56414c494400000000000000000000000000604082015260600190565b60208082526014908201527f574554485f5452414e534645525f4641494c4544000000000000000000000000604082015260600190565b81518152602080830151908201526040918201519181019190915260600190565b815173ffffffffffffffffffffffffffffffffffffffff16815260209182015163ffffffff169181019190915260400190565b815167ffffffffffffffff1681526020808301516bffffffffffffffffffffffff90811691830191909152604092830151169181019190915260600190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b948552602085019390935260408401919091526060830152608082015260a00190565b94855263ffffffff938416602086015260408501929092528216606084015216608082015260a00190565b92835260ff918216602084015216604082015260600190565b63ffffffff91909116815260200190565b63ffffffff92831681529116602082015260400190565b60ff91909116815260200190565b60ff929092168252602082015260400190565b60ff9390931683526020830191909152604082015260600190565b60028110610f7357fe5b73ffffffffffffffffffffffffffffffffffffffff81168114610f7357600080fd5b8015158114610f7357600080fd5b60028110610f7357600080fd5b63ffffffff81168114610f7357600080fdfea365627a7a723158204003618f6c03f1af7bc4ce4395045c4daf1b1bb0cfdb9b3a5cb30deba631ee256c6578706572696d656e74616cf564736f6c634300050c0040" - }, - "deployedBytecode": { - "object": "0x6080604052600436106103555760003560e01c80639051c3ee116101bb578063bb7ef7e0116100f7578063e8eeb3f811610095578063f18765321161006f578063f187653214610955578063f252b7a114610975578063f2fde38b14610995578063ff691b11146109b557610355565b8063e8eeb3f81461090b578063e907f00314610920578063ee99205c1461094057610355565b8063dcb31f76116100d1578063dcb31f76146108ac578063e0ee036e146108c1578063e1c7392a146108d6578063e804d0a4146108eb57610355565b8063bb7ef7e01461084a578063c18c91411461086a578063d39de6e91461088a57610355565b8063a694fc3a11610164578063b2baa33e1161013e578063b2baa33e146107d5578063b3e33379146107ea578063b510879f1461080a578063b91816111461082a57610355565b8063a694fc3a14610780578063abe0906a146107a0578063b0531524146107c057610355565b8063a26171e211610195578063a26171e214610743578063a3b4a32714610758578063a657e5791461076b57610355565b80639051c3ee146106ee5780639ad26744146107035780639c3ccc821461072357610355565b80634e67339f116102955780636340380111610233578063766718081161020d578063766718081461068257806381666796146106975780638a2e271a146106b95780638da5cb5b146106d957610355565b8063634038011461062d57806368a7d6cd14610642578063707129391461066257610355565b80635bd4ab731161026f5780635bd4ab73146105a55780635d91121d146105d25780635e615a6b146105f2578063624a72321461061857610355565b80634e67339f14610550578063587da0231461057057806358f6c7e31461058557610355565b80633c277fc51161030257806344a6958b116102dc57806344a6958b146104b657806346b97959146104d6578063494503d4146105035780634bcc3f671461052357610355565b80633c277fc5146104475780633e4ad7321461046957806342f1181e1461049657610355565b80632a94c279116103335780632a94c279146103c75780632e17de78146103f657806338229d931461041657610355565b806301e28d841461035a5780630b9663db1461037c5780631e7ff8f6146103a7575b600080fd5b34801561036657600080fd5b5061037a6103753660046151e2565b6109d5565b005b34801561038857600080fd5b50610391610aa3565b60405161039e9190615561565b60405180910390f35b3480156103b357600080fd5b506103916103c23660046151e2565b610bf0565b3480156103d357600080fd5b506103e76103e2366004615315565b610c8a565b60405161039e9392919061574e565b34801561040257600080fd5b5061037a6104113660046152d9565b610cb6565b34801561042257600080fd5b506104366104313660046152d9565b610e6b565b60405161039e95949392919061577f565b34801561045357600080fd5b5061045c610e9a565b60405161039e919061545e565b34801561047557600080fd5b506104896104843660046152d9565b610f43565b60405161039e919061570f565b3480156104a257600080fd5b5061037a6104b13660046151e2565b610f62565b3480156104c257600080fd5b506104896104d1366004615285565b610f76565b3480156104e257600080fd5b506104f66104f13660046152d9565b610fd5565b60405161039e91906156bb565b34801561050f57600080fd5b5061045c61051e3660046152d9565b611020565b34801561052f57600080fd5b5061054361053e3660046152d9565b611054565b60405161039e91906156dc565b34801561055c57600080fd5b5061037a61056b3660046151e2565b6110b6565b34801561057c57600080fd5b506103916110fd565b34801561059157600080fd5b5061037a6105a036600461537e565b611103565b3480156105b157600080fd5b506105c56105c03660046151e2565b611300565b60405161039e9190615556565b3480156105de57600080fd5b5061037a6105ed366004615336565b611315565b3480156105fe57600080fd5b506106076113de565b60405161039e9594939291906157a2565b34801561062457600080fd5b5061045c611407565b34801561063957600080fd5b50610391611472565b34801561064e57600080fd5b5061039161065d366004615431565b611478565b34801561066e57600080fd5b5061037a61067d3660046151e2565b6115b1565b34801561068e57600080fd5b50610391611666565b3480156106a357600080fd5b506106ac61166c565b60405161039e91906157e6565b3480156106c557600080fd5b5061037a6106d43660046151e2565b611678565b3480156106e557600080fd5b5061045c61173a565b3480156106fa57600080fd5b5061045c611756565b34801561070f57600080fd5b5061037a61071e36600461525a565b611772565b34801561072f57600080fd5b5061037a61073e3660046153d3565b611784565b34801561074f57600080fd5b506103916117fe565b61037a61076636600461521a565b611804565b34801561077757600080fd5b50610391611a54565b34801561078c57600080fd5b5061037a61079b3660046152d9565b611a5a565b3480156107ac57600080fd5b5061037a6107bb3660046151e2565b611b6f565b3480156107cc57600080fd5b50610391611bb6565b3480156107e157600080fd5b50610391611bbc565b3480156107f657600080fd5b5061037a6108053660046152d9565b611bda565b34801561081657600080fd5b5061037a6108253660046152d9565b611c1a565b34801561083657600080fd5b506105c56108453660046151e2565b611c24565b34801561085657600080fd5b506103916108653660046152d9565b611c39565b34801561087657600080fd5b506103916108853660046152d9565b611cc4565b34801561089657600080fd5b5061089f611cd6565b60405161039e91906154fd565b3480156108b857600080fd5b5061045c611d45565b3480156108cd57600080fd5b506106ac611d61565b3480156108e257600080fd5b5061037a611d6d565b3480156108f757600080fd5b50610489610906366004615362565b611d87565b34801561091757600080fd5b506106ac611ed7565b34801561092c57600080fd5b5061039161093b3660046152f1565b611eeb565b34801561094c57600080fd5b5061045c611f88565b34801561096157600080fd5b506103916109703660046151e2565b611fa4565b34801561098157600080fd5b5061048961099036600461525a565b611fb6565b3480156109a157600080fd5b5061037a6109b03660046151e2565b611ff7565b3480156109c157600080fd5b5061037a6109d03660046152d9565b61209a565b6109dd6122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16610a1d57610a1d610a186001836122ea565b61238c565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517ff50d0d312d501878616eb5e78ebf3ed6dcd3955aaef8165af9c6b057cc4832fb90610a9890839061545e565b60405180910390a150565b600c5460009081610abb82600163ffffffff61239416565b6000818152601660205260409020600101549091508015610ae357610ae3610a1883836123b3565b610aeb6123d0565b610af3612443565b600084815260166020526040902055610b0a6150ee565b50600083815260166020908152604091829020825160a08101845281548082526001830154938201849052600283015482860181905260038401546060840181905260049094015460808401529451919488947fbb4a26fa0ace13ee4da343896c20eaa44a618fb9071fdd8c2e2c960a4583189d94610b8c9491939291615764565b60405180910390a2610b9c6124e7565b6020810151610be357805160405185917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b291610bda916000916155ac565b60405180910390a25b6020015193505050505b90565b6000610bfa611407565b73ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401610c32919061545e565b60206040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c8291908101906153bb565b90505b919050565b601560209081526000928352604080842090915290825290208054600182015460029092015490919083565b33610cbf61511d565b73ffffffffffffffffffffffffffffffffffffffff821660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610d0c9061252a565b90506000610d3e82602001516bffffffffffffffffffffffff1683604001516bffffffffffffffffffffffff166125d0565b905080841115610d5557610d55610a1885836125e6565b73ffffffffffffffffffffffffffffffffffffffff831660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020610da39085612603565b610dab611407565b73ffffffffffffffffffffffffffffffffffffffff16639470b0bd84866040518363ffffffff1660e01b8152600401610de59291906154d7565b600060405180830381600087803b158015610dff57600080fd5b505af1158015610e13573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd85604051610e5d9190615561565b60405180910390a250505050565b601660205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcb31f766040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f3d91908101906151fe565b91505090565b610f4b61511d565b6000828152600760205260409020610c829061252a565b610f6a61268a565b610f73816126d1565b50565b610f7e61511d565b610fcc60056000846001811115610f9157fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff88168252909252902061252a565b90505b92915050565b610fdd61513d565b506000908152601560209081526040808320600c548452825291829020825160608101845281548152600182015492810192909252600201549181019190915290565b6002818154811061102d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61105c61515e565b506000908152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff169082015290565b601980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5481565b338161110f57506112fb565b600061111e6020860186615362565b600181111561112957fe5b14801561114d575060006111406020850185615362565b600181111561114b57fe5b145b1561115857506112fb565b60016111676020860186615362565b600181111561117257fe5b14156111875761118784602001358284612802565b60016111966020850185615362565b60018111156111a157fe5b14156111b6576111b68360200135828461289b565b60006005816111c86020880188615362565b60018111156111d357fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff861682528352908120925090600590829061121d90880188615362565b600181111561122857fe5b60ff1681526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff871682529092529020905061126b828286612934565b60208086013590870180359073ffffffffffffffffffffffffffffffffffffffff8616907f7d3ad1dcf03b9027064d1d9a474a69e0cecc31324c541d3eb9b5e6fa2f106c8d9088906112bd908c615362565b60018111156112c857fe5b6112d560208c018c615362565b60018111156112e057fe5b6040516112ef939291906157cd565b60405180910390a45050505b505050565b60106020526000908152604090205460ff1681565b8161131f81612a2d565b6000838152600a602052604090205474010000000000000000000000000000000000000000900463ffffffff16611357848285612a66565b6000848152600a60205260409081902080547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8716021790555184907f8ea2a7a959bd25f226b7b0a4393613f7fdcaa8404e8bad96aa52dc1c1459016790610e5d90849087906157f7565b601154601254601354601454929363ffffffff9283169391928281169264010000000090041690565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639051c3ee6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0557600080fd5b60115481565b600854600090339061149190600163ffffffff612aad16565b600881905591506114a682620f424086612a66565b6114ae61515e565b5060408051808201825273ffffffffffffffffffffffffffffffffffffffff838116825263ffffffff87811660208085019182526000888152600a9091528590208451815492517fffffffffffffffffffffffff00000000000000000000000000000000000000009093169416939093177fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000919092160217905590517fcec6fc86ea644053f6edff1160dfe3fa5c61e7a5ef9f873f145bb03a0bd319e7906115929085908590899061556a565b60405180910390a183156115a9576115a983611bda565b505092915050565b6115b961268a565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166115f2576115f2610a1882612ac9565b60005b600254811015611662578173ffffffffffffffffffffffffffffffffffffffff166002828154811061162357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561165a576116558282612b68565b611662565b6001016115f5565b5050565b600c5481565b60145463ffffffff1681565b6116806122c7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526010602052604090205460ff16156116bc576116bc610a186000836122ea565b73ffffffffffffffffffffffffffffffffffffffff81166000908152601060205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f3e535d1ab441ef41c268fd9b52b478aee02d693c5ca2a84b5d26b89e0922e5e190610a9890839061545e565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60195473ffffffffffffffffffffffffffffffffffffffff1681565b61177a61268a565b6116628282612b68565b61178c6122c7565b6117998585858585612db7565b3073ffffffffffffffffffffffffffffffffffffffff1663c6f3a4276040518163ffffffff1660e01b815260040160006040518083038186803b1580156117df57600080fd5b505afa1580156117f3573d6000803e3d6000fd5b505050505050505050565b60135481565b3360009081526010602052604090205460ff1661182757611827610a1833612e7a565b61183081612e95565b3461190a5761183d610e9a565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd8330846040518463ffffffff1660e01b8152600401611879939291906154a6565b602060405180830381600087803b15801561189357600080fd5b505af11580156118a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118cb91908101906152bd565b61190a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190190615684565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152600960205260409020548061193b57506112fb565b600061194682610f43565b602001516bffffffffffffffffffffffff16905060135481101561196b5750506112fb565b600c54600083815260156020908152604080832084845282528083206016909252909120815480611a1a576000806119a38888612eb6565b6002870182905560018701819055600386015491935091506119cb908263ffffffff612aad16565b60038501556001808501546119e59163ffffffff612aad16565b6001850155604051889087907f14b098103235344975b17508c2391721cc9ac3f3fa2b56c7ff46f8480dfd074f90600090a350505b611a2a818863ffffffff612aad16565b83556002820154611a41908863ffffffff612aad16565b8260020181905550505050505050505050565b60085481565b33611a63611407565b73ffffffffffffffffffffffffffffffffffffffff166315cc36f282846040518363ffffffff1660e01b8152600401611a9d9291906154d7565b600060405180830381600087803b158015611ab757600080fd5b505af1158015611acb573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff811660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc60205260409020611b1d9083612f42565b8073ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a83604051611b639190615561565b60405180910390a25050565b601880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60175481565b6000611bd5601154600d54612aad90919063ffffffff16565b905090565b3360008181526009602052604080822084905551839183917f5640833634fce74eb9211d1209a91dd5a1c8c6a751696bff9323b4db67f815139190a35050565b610f738133612fac565b60016020526000908152604090205460ff1681565b6000611c4361515e565b506000828152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611ca785613184565b91509150611cba83602001518383613241565b5095945050505050565b600b6020526000908152604090205481565b60606002805480602002602001604051908101604052809291908181526020018280548015611d3b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611d10575b5050505050905090565b60185473ffffffffffffffffffffffffffffffffffffffff1681565b60125463ffffffff1681565b611d756122c7565b611d7d613282565b611d85613295565b565b611d8f61511d565b60016000526004602052611dc27fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0561252a565b90506000826001811115611dd257fe5b1415610c85576000611de2611407565b73ffffffffffffffffffffffffffffffffffffffff16639706e0c06040518163ffffffff1660e01b815260040160206040518083038186803b158015611e2757600080fd5b505afa158015611e3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e5f91908101906153bb565b9050611e8e611e8983602001516bffffffffffffffffffffffff168361239490919063ffffffff16565b6132c0565b6bffffffffffffffffffffffff90811660208401526040830151611ebe91611e899184911663ffffffff61239416565b6bffffffffffffffffffffffff16604083015250919050565b601454640100000000900463ffffffff1681565b6000611ef561515e565b506000838152600a6020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000900463ffffffff16918101919091529080611f5986613184565b915091506000611f6e84602001518484613241565b915050611f7d878783856132e4565b979650505050505050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60096020526000908152604090205481565b611fbe61511d565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602090815260408083208584529091529020610fcc9061252a565b611fff61268a565b73ffffffffffffffffffffffffffffffffffffffff811661202a57612025610a18613431565b610f73565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600c5460006120b082600163ffffffff61239416565b90506120ba6150ee565b50600081815260166020908152604091829020825160a0810184528154815260018201549281018390526002820154938101939093526003810154606084015260040154608083015261210f57505050610f73565b61211761513d565b50600084815260156020908152604080832085845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526121655750505050610f73565b60008581526015602090815260408083208684529091528120818155600181018290556002018190556121988284613468565b90506000806121ac888486604001516134dd565b9150915087877ff1116b309178aa62dcb6bf8c3b8bc2321724907c7ebf52192d14c8ce3aa9194c84846040516121e39291906155ac565b60405180910390a360006121fd838363ffffffff612aad16565b6080870151909150612215908263ffffffff612aad16565b6080870181905260008881526016602090815260409091206004019190915586015161224890600163ffffffff61239416565b602080880182815260008a81526016909252604090912060010191909155516117f3576080860151865188917fb463d19ecf455be65365092cf8e1db6934a0334cf8cd532ddf9964d01f36b5b2916122a6908263ffffffff61239416565b6040516122b49291906155ac565b60405180910390a2505050505050505050565b3360009081526001602052604090205460ff16611d8557611d85610a183361362d565b606063b9588e4360e01b83836040516024016123079291906155f4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b6000828211156123ad576123ad610a1860028585613648565b50900390565b606063614b800a60e01b83836040516024016123079291906155ac565b30318015610f73576123e0610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561242757600080fd5b505af115801561243b573d6000803e3d6000fd5b505050505050565b6000611bd5601754612453610e9a565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161248b919061545e565b60206040518083038186803b1580156124a357600080fd5b505afa1580156124b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506124db91908101906153bb565b9063ffffffff61239416565b4260006124f2611bbc565b90508181111561250957612509610a1882846136ed565b600c5460009061252090600163ffffffff612aad16565b600c555050600d55565b61253261511d565b5060408051606081018252825467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811660208501527401000000000000000000000000000000000000000090920490911692820192909252600c5490918111156125ca576125a58161370a565b67ffffffffffffffff16825260408201516bffffffffffffffffffffffff1660208301525b50919050565b60008183106125df5781610fcc565b5090919050565b60606384c8b7c960e01b83836040516024016123079291906155ac565b61260b61511d565b6126148361252a565b905061263e611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff61239416565b6bffffffffffffffffffffffff1660208201526112fb838261372a565b60005473ffffffffffffffffffffffffffffffffffffffff163314611d8557600054611d8590610a1890339073ffffffffffffffffffffffffffffffffffffffff166137e4565b73ffffffffffffffffffffffffffffffffffffffff81166126f7576126f7610a18613801565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561273157612731610a1882613838565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b61280b83613853565b6128158383612fac565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600660209081526040808320868452909152902061284f908261388a565b6000838152600760205260409020612867908261388a565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe058261388a565b6128a483613853565b6128ae8383612fac565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260066020908152604080832086845290915290206128e890826138e2565b600083815260076020526040902061290090826138e2565b600160005260046020526112fb7fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe05826138e2565b61293e838361391d565b15612948576112fb565b61295061511d565b6129598461252a565b905061296361511d565b61296c8461252a565b905081604001516bffffffffffffffffffffffff168311156129a7576129a7610a188484604001516bffffffffffffffffffffffff166125e6565b60408201516129ce90611e89906bffffffffffffffffffffffff168563ffffffff61239416565b6bffffffffffffffffffffffff9081166040808501919091528201516129ff91611e8991168563ffffffff612aad16565b6bffffffffffffffffffffffff166040820152612a1c858361372a565b612a26848261372a565b5050505050565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff1633811461166257611662610a183384613924565b620f424063ffffffff82161115612a8b57612a86610a1860008584613941565b6112fb565b8163ffffffff168163ffffffff16106112fb576112fb610a1860018584613941565b600082820183811015610fcc57610fcc610a1860008686613648565b606063eb5108a260e01b82604051602401612ae4919061545e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16612ba157612ba1610a1883612ac9565b6002548110612bbc57612bbc610a1882600280549050613960565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110612be057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614612c4257612c42610a1860028381548110612c1a57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff168461397d565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110612cbd57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110612cf057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190612d6f9082615175565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60118590556012805463ffffffff8087167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000092831617909255601385905560148054848416640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff9487169190931617929092161790556040517f613157dbb0e920deab8ad6ddd3805e87cbf57344b9fe780f1764790ec789754290612e6b90879087908790879087906157a2565b60405180910390a15050505050565b606063b56d2df060e01b82604051602401612ae4919061545e565b803414158015612ea457503415155b15610f7357610f73610a18823461399a565b6000828152600a602052604081205481908190612ee99073ffffffffffffffffffffffffffffffffffffffff1686611fb6565b602001516bffffffffffffffffffffffff169050612f0d848263ffffffff61239416565b601254909350612f3890612f2b9063ffffffff16620f4240866139b7565b829063ffffffff612aad16565b9150509250929050565b612f4a61511d565b612f538361252a565b9050612f7d611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b6bffffffffffffffffffffffff9081166040830152602082015161266d91611e8991168463ffffffff612aad16565b612fb5826139d9565b6000612fc483836000806132e4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832087845290915290209091506130009061252a565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600660209081526040808320888452825291829020845181549286015195909301517fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090921667ffffffffffffffff909316929092177fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff16680100000000000000006bffffffffffffffffffffffff9586160217909216740100000000000000000000000000000000000000009390921692909202179055801561317b576130e58382613a4d565b6130ed610e9a565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016131279291906154d7565b602060405180830381600087803b15801561314157600080fd5b505af1158015613155573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061317991908101906152bd565b505b6112fb83613a95565b600080600061319f6001600c5461239490919063ffffffff16565b90506131a961513d565b50600084815260156020908152604080832084845282528083208151606080820184528254825260018084015483870152600293840154838601528787526016865295849020845160a0810186528154815296810154958701959095529184015492850192909252600383015490840152600490910154608083015290613231908290613468565b9350806040015192505050915091565b600080826132515783915061327a565b61326563ffffffff8616620f424086613aa2565b9150613277848363ffffffff61239416565b90505b935093915050565b61328a613ad8565b42600d556001600c55565b61329d613aed565b620d2f00620dbba068056bc75e2d6310000060026003612a268585858585612db7565b806bffffffffffffffffffffffff81168114610c8557610c85610a18600284613b52565b600c546000906132f261511d565b5073ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083208984528252918290208251606081018452905467ffffffffffffffff81168083526bffffffffffffffffffffffff680100000000000000008304811694840194909452740100000000000000000000000000000000000000009091049092169281019290925282141561339357600092505050613429565b61339f81838787613b6f565b81519093506000906133c29067ffffffffffffffff16600163ffffffff612aad16565b90506134006133f38984602001516bffffffffffffffffffffffff16856000015167ffffffffffffffff1685613bf2565b859063ffffffff612aad16565b93506134236133f38984604001516bffffffffffffffffffffffff168487613bf2565b93505050505b949350505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b815160009061347657610fcf565b815183516040840151602086015160608601516014546134ac95949392919063ffffffff80821691640100000000900416613c8b565b608083015183519192506000916134c89163ffffffff61239416565b9050818110156134d6578091505b5092915050565b6000806134e861515e565b506000858152600a602090815260409182902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900463ffffffff1690820181905261354c908686613241565b909350915082156136095761355f610e9a565b81516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff929092169163a9059cbb916135b59187906004016154d7565b602060405180830381600087803b1580156135cf57600080fd5b505af11580156135e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061360791908101906152bd565b505b8115613624576136198683613d4e565b613624868386613d8f565b50935093915050565b606063b65a25b960e01b82604051602401612ae4919061545e565b606063e946c1bb60e01b848484604051602401613667939291906155ba565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b606063a6bcde4760e01b83836040516024016123079291906155ac565b8067ffffffffffffffff81168114610c8557610c85610a18600184613b52565b8051825460408301516020909301516bffffffffffffffffffffffff90811668010000000000000000027fffffffffffffffffffffffff000000000000000000000000ffffffffffffffff91909416740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff9094167fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000090931692909217929092161716179055565b6060631de45ad160e01b838360405160240161230792919061547f565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b606063de16f1a060e01b82604051602401612ae4919061545e565b6000818152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f7357610f73610a18826000613e78565b61389261511d565b61389b8361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff1661239490919063ffffffff16565b6bffffffffffffffffffffffff1660408201526112fb838261372a565b6138ea61511d565b6138f38361252a565b90506138c5611e898383604001516bffffffffffffffffffffffff16612aad90919063ffffffff16565b1460011690565b60606382ded78560e01b83836040516024016123079291906154d7565b60606322df959760e01b84848460405160240161366793929190615626565b606063e9f8377160e01b83836040516024016123079291906155ac565b606063140a84db60e01b838360405160240161230792919061547f565b60606331d7a50560e01b83836040516024016123079291906155ac565b6000613429836139cd868563ffffffff613e9516565b9063ffffffff613ec616565b600c546000906139f090600163ffffffff61239416565b90506139fa61513d565b5060008281526015602090815260408083208484528252918290208251606081018452815480825260018301549382019390935260029091015492810192909252156112fb576112fb610a188484613ef0565b6000828152600b6020526040902054613a6c908263ffffffff61239416565b6000838152600b6020526040902055601754613a8e908263ffffffff61239416565b6017555050565b610f738160006001613d8f565b6000613429836139cd613abc82600163ffffffff61239416565b613acc888763ffffffff613e9516565b9063ffffffff612aad16565b600d5415611d8557611d85610a186000613f0d565b60115415801590613b05575060125463ffffffff1615155b8015613b12575060135415155b8015613b25575060145463ffffffff1615155b8015613b405750601454640100000000900463ffffffff1615155b15611d8557611d85610a186001613f0d565b606063c996af7b60e01b83836040516024016123079291906155dc565b6000821580613b7c575081155b15613b8957506000613429565b6000613b9c85600163ffffffff61239416565b865167ffffffffffffffff161015613bb8578560400151613bbe565b85602001515b6bffffffffffffffffffffffff16905080613bdd576000915050613429565b613be88484836139b7565b9695505050505050565b6000831580613c0057508183145b15613c0d57506000613429565b818310613c46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119019061564d565b613c4e615199565b613c588685613f4c565b9050613c62615199565b613c6c8785613f4c565b9050611f7d81600001518260200151846000015185602001518a61406a565b600080613c9888886140f6565b90506000613ca687876140f6565b9050811580613cb3575080155b15613cc4575060009150611f7d9050565b600081831315613cdd57613cd88284614148565b613ce7565b613ce78383614148565b9050613d10613d0b613cf883614167565b8863ffffffff168863ffffffff16614809565b614818565b905081831315613d2957613d248282614148565b613d33565b613d338282614e02565b9050613d3f818c614e2e565b9b9a5050505050505050505050565b6000828152600b6020526040902054613d6d908263ffffffff612aad16565b6000838152600b6020526040902055601754613a8e908263ffffffff612aad16565b6000838152600f6020526040902054600c5480821415613db05750506112fb565b613db8615199565b506000858152600e602090815260408083208584528252918290208251808401909352805483526001015490820152613def615199565b613df882614e70565b15613e3157613e11826000015183602001518888614e79565b60208301819052818352613e259190614edb565b60208301528152613e3c565b602081018590528581525b6000878152600e6020908152604080832086845282528083208451815593820151600190940193909355978152600f9097529095205550505050565b6060639ae94f0160e01b838360405160240161230792919061559c565b600082613ea457506000610fcf565b82820282848281613eb157fe5b0414610fcc57610fcc610a1860018686613648565b600081613edc57613edc610a1860038585613648565b6000828481613ee757fe5b04949350505050565b6060635caa0b0560e01b83836040516024016123079291906155ac565b60607f0b02d77300000000000000000000000000000000000000000000000000000000826001811115613f3c57fe5b604051602401612ae4919061580e565b613f54615199565b506000828152600e602090815260408083208484528252918290208251808401909352805483526001015490820152613f8c81614e70565b15613f9657610fcf565b6000613fa983600163ffffffff61239416565b6000858152600e60209081526040808320848452825291829020825180840190935280548352600101549082015292509050613fe482614e70565b15613fef5750610fcf565b6000848152600f60205260409020548381101561404c576000858152600e602090815260408083208484528252918290208251808401909352805483526001015490820152925061403f83614e70565b1561404c5750610fcf9050565b50506040805180820190915260008152600160208201529392505050565b600081614079575060006140ed565b8361409957614092856139cd848963ffffffff613e9516565b90506140ed565b60006140be6140ae868863ffffffff613e9516565b6124db898763ffffffff613e9516565b905060006140d2828663ffffffff613ec616565b90506140e8876139cd868463ffffffff613e9516565b925050505b95945050505050565b60008083121561410e5761410e610a18600185614f04565b600082121561412557614125610a18600184614f04565b610fcc614142846f80000000000000000000000000000000614f45565b83614f8d565b6000610fcc614142846f80000000000000000000000000000000614f45565b60006f8000000000000000000000000000000082131561418f5761418f610a1860018461500e565b600082136141a5576141a5610a1860008461500e565b6f800000000000000000000000000000008214156141c557506000610c85565b640733048c5a82136141f857507fffffffffffffffffffffffffffffffe010000000000000000000000000000000610c85565b60008060006a01c8464f761647600000008513614257577ffffffffffffffffffffffffffffffff000000000000000000000000000000000909301926a01c8464f761647600000006f8000000000000000000000000000000086020594505b6cf1aaddd7742e9000000000000085136142b5577ffffffffffffffffffffffffffffffff800000000000000000000000000000000909301926cf1aaddd7742e900000000000006f8000000000000000000000000000000086020594505b6e0afe10820813d780000000000000008513614317577ffffffffffffffffffffffffffffffffc00000000000000000000000000000000909301926e0afe10820813d780000000000000006f8000000000000000000000000000000086020594505b6f02582ab704279ec00000000000000000851361437b577ffffffffffffffffffffffffffffffffe00000000000000000000000000000000909301926f02582ab704279ec000000000000000006f8000000000000000000000000000000086020594505b6f1152aaa3bf81cc00000000000000000085136143df577fffffffffffffffffffffffffffffffff00000000000000000000000000000000909301926f1152aaa3bf81cc0000000000000000006f8000000000000000000000000000000086020594505b6f2f16ac6c59de700000000000000000008513614443577fffffffffffffffffffffffffffffffff80000000000000000000000000000000909301926f2f16ac6c59de700000000000000000006f8000000000000000000000000000000086020594505b6f4da2cbf1be582800000000000000000085136144a7577fffffffffffffffffffffffffffffffffc0000000000000000000000000000000909301926f4da2cbf1be58280000000000000000006f8000000000000000000000000000000086020594505b6f63afbe7ab2082c000000000000000000851361450b577fffffffffffffffffffffffffffffffffe0000000000000000000000000000000909301926f63afbe7ab2082c0000000000000000006f8000000000000000000000000000000086020594505b6f70f5a893b608861e1f58934f97aea57d851361456f577ffffffffffffffffffffffffffffffffff0000000000000000000000000000000909301926f70f5a893b608861e1f58934f97aea57d6f8000000000000000000000000000000086020594505b7fffffffffffffffffffffffffffffffff80000000000000000000000000000000850192508291506f80000000000000000000000000000000828002059050700100000000000000000000000000000000838103830205840193506f80000000000000000000000000000000818302816145e557fe5b059150700200000000000000000000000000000000836faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0383028161461657fe5b05840193506f800000000000000000000000000000008183028161463657fe5b059150700300000000000000000000000000000000836f999999999999999999999999999999990383028161466757fe5b05840193506f800000000000000000000000000000008183028161468757fe5b059150700400000000000000000000000000000000836f92492492492492492492492492492492038302816146b857fe5b05840193506f80000000000000000000000000000000818302816146d857fe5b059150700500000000000000000000000000000000836f8e38e38e38e38e38e38e38e38e38e38e0383028161470957fe5b05840193506f800000000000000000000000000000008183028161472957fe5b059150700600000000000000000000000000000000836f8ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b0383028161475a57fe5b05840193506f800000000000000000000000000000008183028161477a57fe5b059150700700000000000000000000000000000000836f89d89d89d89d89d89d89d89d89d89d89038302816147ab57fe5b05840193506f80000000000000000000000000000000818302816147cb57fe5b059150700800000000000000000000000000000000836f88888888888888888888888888888888038302816147fc57fe5b0584019350505050919050565b60006134296141428585614f45565b60007fffffffffffffffffffffffffffffffe01000000000000000000000000000000082121561484a57506000610c85565b8161486657506f80000000000000000000000000000000610c85565b600082131561487d5761487d610a1860018461500e565b6f800000000000000000000000000000006f1000000000000000000000000000000083078080028290056710e1b3be415a0000810293909301929091818302059050806705a0913f6b1e000002830192506f80000000000000000000000000000000828202816148e957fe5b05905080670168244fdac7800002830192506f800000000000000000000000000000008282028161491657fe5b05905080664807432bc1800002830192506f800000000000000000000000000000008282028161494257fe5b05905080660c0135dca0400002830192506f800000000000000000000000000000008282028161496e57fe5b059050806601b707b1cdc00002830192506f800000000000000000000000000000008282028161499a57fe5b059050806536e0f639b80002830192506f80000000000000000000000000000000828202816149c557fe5b05905080650618fee9f80002830192506f80000000000000000000000000000000828202816149f057fe5b05905080649c197dcc0002830192506f8000000000000000000000000000000082820281614a1a57fe5b05905080640e30dce40002830192506f8000000000000000000000000000000082820281614a4457fe5b0590508064012ebd130002830192506f8000000000000000000000000000000082820281614a6e57fe5b059050806317499f0002830192506f8000000000000000000000000000000082820281614a9757fe5b059050806301a9d48002830192506f8000000000000000000000000000000082820281614ac057fe5b05905080621c638002830192506f8000000000000000000000000000000082820281614ae857fe5b059050806201c63802830192506f8000000000000000000000000000000082820281614b1057fe5b05905080611ab802830192506f8000000000000000000000000000000082820281614b3757fe5b0590508061017c02830192506f8000000000000000000000000000000082820281614b5e57fe5b05905080601402830192506f8000000000000000000000000000000082820281614b8457fe5b600095909503946721c3677c82b400009190059384010582016f8000000000000000000000000000000001929050701000000000000000000000000000000000841615614bf3577243cbaf42a000812488fc5c220ad7b97bf6e99e6cf1aaddd7742e56d32fb9f9974484020592505b700800000000000000000000000000000000841615614c35577105d27a9f51c31b7c2f8038212a05747799916e0afe10820813d65dfe6a33c07f738f84020592505b700400000000000000000000000000000000841615614c7757701b4c902e273a58678d6d3bfdb93db96d026f02582ab704279e8efd15e0265855c47a84020592505b700200000000000000000000000000000000841615614cb9577003b1cc971a9bb5b9867477440d6d1577506f1152aaa3bf81cb9fdb76eae12d02957184020592505b700100000000000000000000000000000000841615614cfb5770015bf0a8b1457695355fb8ac404e7a79e36f2f16ac6c59de6f8d5d6f63c1482a7c8684020592505b6f80000000000000000000000000000000841615614d3b576fd3094c70f034de4b96ff7d5b6f99fcd86f4da2cbf1be5827f9eb3ad1aa9866ebb384020592505b6f40000000000000000000000000000000841615614d7b576fa45af1e1f40c333b3de1db4dd55f29a76f63afbe7ab2082ba1a0ae5e4eb1b479dc84020592505b6f20000000000000000000000000000000841615614dbb576f910b022db7ae67ce76b441c27035c6a16f70f5a893b608861e1f58934f97aea57d84020592505b6f10000000000000000000000000000000841615614dfb576f88415abbe9a76bead8d00cf112e4d4a86f783eafef1c0a8f3978c7f81824d62ebf84020592505b5050919050565b60006f80000000000000000000000000000000614e1f8484614f45565b81614e2657fe5b059392505050565b600080821215614e4657614e46610a18600184614f04565b6000614e528484614f45565b905060008113614e66576000915050610fcf565b607f1c9392505050565b60200151151590565b60008085614e8b575082905081614ed2565b83614e9a575084905083614ed2565b614ebd614ead858763ffffffff613e9516565b613acc888663ffffffff613e9516565b9150614ecf858463ffffffff613e9516565b90505b94509492505050565b600080614ef984846f8000000000000000000000000000000061503d565b915091509250929050565b60607fbd79545f00000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b8360405160240161230792919061581c565b600082614f5457506000610fcf565b5081810281838281614f6257fe5b05141580614f79575082828281614f7557fe5b0514155b15610fcf57610fcf610a18600185856150ab565b600081614fa357614fa3610a18600285856150ab565b7f800000000000000000000000000000000000000000000000000000000000000083148015614ff15750817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff145b1561500557615005610a18600385856150ab565b818381614e2657fe5b60607fed2f26a100000000000000000000000000000000000000000000000000000000836001811115614f3357fe5b6000808285118061504d57508284115b156150a2576000848610156150625784615064565b855b9050615076818563ffffffff613ec616565b9050615088868263ffffffff613ec616565b925061509a858263ffffffff613ec616565b91505061327a565b50929391925050565b60607f8c12dfe7000000000000000000000000000000000000000000000000000000008460038111156150da57fe5b84846040516024016136679392919061582f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180606001604052806000815260200160008152602001600081525090565b604080518082019091526000808252602082015290565b8154818355818111156112fb576000838152602090206112fb9181019083016151b3565b604051806040016040528060008152602001600081525090565b610bed91905b808211156151cd57600081556001016151b9565b5090565b6000604082840312156125ca578081fd5b6000602082840312156151f3578081fd5b8135610fcc81615854565b60006020828403121561520f578081fd5b8151610fcc81615854565b60008060006060848603121561522e578182fd5b833561523981615854565b9250602084013561524981615854565b929592945050506040919091013590565b6000806040838503121561526c578182fd5b823561527781615854565b946020939093013593505050565b60008060408385031215615297578182fd5b82356152a281615854565b915060208301356152b281615884565b809150509250929050565b6000602082840312156152ce578081fd5b8151610fcc81615876565b6000602082840312156152ea578081fd5b5035919050565b60008060408385031215615303578182fd5b8235915060208301356152b281615854565b60008060408385031215615327578182fd5b50508035926020909101359150565b60008060408385031215615348578182fd5b82359150602083013563ffffffff811681146152b2578182fd5b600060208284031215615373578081fd5b8135610fcc81615884565b600080600060a08486031215615392578283fd5b61539c85856151d1565b92506153ab85604086016151d1565b9150608084013590509250925092565b6000602082840312156153cc578081fd5b5051919050565b600080600080600060a086880312156153ea578283fd5b8535945060208601356153fc81615891565b935060408601359250606086013561541381615891565b9150608086013561542381615891565b809150509295509295909350565b60008060408385031215615443578182fd5b823561544e81615891565b915060208301356152b281615876565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000918401906040840190835b8181101561554b57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101615517565b509095945050505050565b901515815260200190565b90815260200190565b92835273ffffffffffffffffffffffffffffffffffffffff91909116602083015263ffffffff16604082015260600190565b9182521515602082015260400190565b918252602082015260400190565b60608101600485106155c857fe5b938152602081019290925260409091015290565b60408101600384106155ea57fe5b9281526020015290565b604081016156018461584a565b92815273ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b606081016156338561584a565b938152602081019290925263ffffffff1660409091015290565b60208082526013908201527f43525f494e54455256414c5f494e56414c494400000000000000000000000000604082015260600190565b60208082526014908201527f574554485f5452414e534645525f4641494c4544000000000000000000000000604082015260600190565b81518152602080830151908201526040918201519181019190915260600190565b815173ffffffffffffffffffffffffffffffffffffffff16815260209182015163ffffffff169181019190915260400190565b815167ffffffffffffffff1681526020808301516bffffffffffffffffffffffff90811691830191909152604092830151169181019190915260600190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b948552602085019390935260408401919091526060830152608082015260a00190565b94855263ffffffff938416602086015260408501929092528216606084015216608082015260a00190565b92835260ff918216602084015216604082015260600190565b63ffffffff91909116815260200190565b63ffffffff92831681529116602082015260400190565b60ff91909116815260200190565b60ff929092168252602082015260400190565b60ff9390931683526020830191909152604082015260600190565b60028110610f7357fe5b73ffffffffffffffffffffffffffffffffffffffff81168114610f7357600080fd5b8015158114610f7357600080fd5b60028110610f7357600080fd5b63ffffffff81168114610f7357600080fdfea365627a7a723158204003618f6c03f1af7bc4ce4395045c4daf1b1bb0cfdb9b3a5cb30deba631ee256c6578706572696d656e74616cf564736f6c634300050c0040" - } - } - }, - "compiler": { - "name": "solc", - "version": "soljson-v0.5.12+commit.7709ece9.js", - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000, - "details": { "yul": true, "deduplicate": true, "cse": true, "constantOptimizer": true } - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode.object", - "evm.bytecode.sourceMap", - "evm.deployedBytecode.object", - "evm.deployedBytecode.sourceMap" - ] - } - }, - "evmVersion": "constantinople" - } - }, - "chains": {} -} diff --git a/packages/contract-artifacts/artifacts/ZrxVault.json b/packages/contract-artifacts/artifacts/ZrxVault.json index eaaf03a406..875d02e484 100644 --- a/packages/contract-artifacts/artifacts/ZrxVault.json +++ b/packages/contract-artifacts/artifacts/ZrxVault.json @@ -260,6 +260,82 @@ "type": "function" } ], + "devdoc": { + "methods": { + "addAuthorizedAddress(address)": { + "details": "Authorizes an address.", + "params": { + "target": "Address to authorize." + } + }, + "balanceOf(address)": { + "details": "Returns the balance in Zrx Tokens of the `staker`", + "return": "Balance in Zrx." + }, + "balanceOfZrxVault()": { + "details": "Returns the entire balance of Zrx tokens in the vault." + }, + "constructor": { + "details": "Constructor.", + "params": { + "_zrxProxyAddress": "Address of the 0x Zrx Proxy.", + "_zrxTokenAddress": "Address of the Zrx Token." + } + }, + "depositFrom(address,uint256)": { + "details": "Deposit an `amount` of Zrx Tokens from `staker` into the vault. Note that only the Staking contract can call this. Note that this can only be called when *not* in Catastrophic Failure mode.", + "params": { + "amount": "of Zrx Tokens to deposit.", + "staker": "of Zrx Tokens." + } + }, + "enterCatastrophicFailure()": { + "details": "Vault enters into Catastrophic Failure Mode. *** WARNING - ONCE IN CATOSTROPHIC FAILURE MODE, YOU CAN NEVER GO BACK! *** Note that only the contract owner can call this function." + }, + "getAuthorizedAddresses()": { + "details": "Gets all authorized addresses.", + "return": "Array of authorized addresses." + }, + "removeAuthorizedAddress(address)": { + "details": "Removes authorizion of an address.", + "params": { + "target": "Address to remove authorization from." + } + }, + "removeAuthorizedAddressAtIndex(address,uint256)": { + "details": "Removes authorizion of an address.", + "params": { + "index": "Index of target in authorities array.", + "target": "Address to remove authorization from." + } + }, + "setStakingProxy(address)": { + "details": "Sets the address of the StakingProxy contract. Note that only the contract owner can call this function.", + "params": { + "_stakingProxyAddress": "Address of Staking proxy contract." + } + }, + "setZrxProxy(address)": { + "details": "Sets the Zrx proxy. Note that only an authorized address can call this function. Note that this can only be called when *not* in Catastrophic Failure mode.", + "params": { + "_zrxProxyAddress": "Address of the 0x Zrx Proxy." + } + }, + "withdrawAllFrom(address)": { + "details": "Withdraw ALL Zrx Tokens to `staker` from the vault. Note that this can only be called when *in* Catastrophic Failure mode.", + "params": { + "staker": "of Zrx Tokens." + } + }, + "withdrawFrom(address,uint256)": { + "details": "Withdraw an `amount` of Zrx Tokens to `staker` from the vault. Note that only the Staking contract can call this. Note that this can only be called when *not* in Catastrophic Failure mode.", + "params": { + "amount": "of Zrx Tokens to withdraw.", + "staker": "of Zrx Tokens." + } + } + } + }, "evm": { "bytecode": { "object": "0x60806040523480156200001157600080fd5b506040516200190238038062001902833981810160405260408110156200003757600080fd5b508051602091820151600080546001600160a01b03199081163317909155600580546001600160a01b0380861691841691909117909155600680549184169190921681179091556040805160248082019390935281518082039093018352604401905292830180516001600160e01b03167ff47261b000000000000000000000000000000000000000000000000000000000178152925191929091620000e091600791620000e9565b5050506200018e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200012c57805160ff19168380011785556200015c565b828001600101855582156200015c579182015b828111156200015c5782518255916020019190600101906200013f565b506200016a9291506200016e565b5090565b6200018b91905b808211156200016a576000815560010162000175565b90565b611764806200019e6000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80639470b0bd116100cd578063c4d8f23711610081578063d39de6e911610066578063d39de6e9146103d1578063f2fde38b14610429578063f957ddba1461045c57610151565b8063c4d8f23714610396578063ca5b02181461039e57610151565b80639ad26744116100b25780639ad2674414610322578063b91816111461035b578063c02e5a7f1461038e57610151565b80639470b0bd146102e15780639706e0c01461031a57610151565b8063494503d4116101245780637071293911610109578063707129391461026157806370a08231146102945780638da5cb5b146102d957610151565b8063494503d4146102115780636bf3f9e51461022e57610151565b806315cc36f214610156578063266df27c1461019157806342f1181e146101ad5780634551ab31146101e0575b600080fd5b61018f6004803603604081101561016c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561048f565b005b610199610676565b604080519115158252519081900360200190f35b61018f600480360360208110156101c357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610697565b6101e86106ab565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101e86004803603602081101561022757600080fd5b50356106c7565b61018f6004803603602081101561024457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106fb565b61018f6004803603602081101561027757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661077c565b6102c7600480360360208110156102aa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610836565b60408051918252519081900360200190f35b6101e861085e565b61018f600480360360408110156102f757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561087a565b6102c7610894565b61018f6004803603604081101561033857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610937565b6101996004803603602081101561037157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610949565b61018f61095e565b6101e86109e2565b61018f600480360360208110156103b457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166109fe565b6103d9610a87565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104155781810151838201526020016103fd565b505050509050019250505060405180910390f35b61018f6004803603602081101561043f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610af6565b6102c76004803603602081101561047257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b99565b610497610bd9565b61049f610c06565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600460205260409020546104d5908263ffffffff610c3416565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604091829020939093558051848152905191927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c92918290030190a26005546040517fa85e59e400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660248301523060448301819052606483018590526080600484019081526007805460027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600183161561010002019091160460848601819052939095169463a85e59e494909388939288929091829160a40190879080156106375780601f1061060c57610100808354040283529160200191610637565b820191906000526020600020905b81548152906001019060200180831161061a57829003601f168201915b505095505050505050600060405180830381600087803b15801561065a57600080fd5b505af115801561066e573d6000803e3d6000fd5b505050505050565b60035474010000000000000000000000000000000000000000900460ff1681565b61069f610c57565b6106a881610c9e565b50565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b600281815481106106d457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b610703610dcf565b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fb72b2a9919ffd08bc0d415d8a38b1395a40377207a9867cac2e3c10b1aa560fc9181900360200190a150565b610784610c57565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166107c2576107c26107bd82610df2565b610e75565b60005b600254811015610832578173ffffffffffffffffffffffffffffffffffffffff16600282815481106107f357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561082a576108258282610e7d565b610832565b6001016107c5565b5050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b610882610bd9565b61088a610c06565b61083282826110cc565b600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561090557600080fd5b505afa158015610919573d6000803e3d6000fd5b505050506040513d602081101561092f57600080fd5b505190505b90565b61093f610c57565b6108328282610e7d565b60016020526000908152604090205460ff1681565b610966610dcf565b61096e610c06565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040805133815290517fdc2ba7cd6b8e3bf6f27f665a737e34fb7f72f480a597b51686332c539fab04489181900360200190a1565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b610a06610dcf565b610a0e610c06565b6005805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fab1ca8eb645c27b1fa85b29ed92584109de7cc576a907cddaa0bf3f1f7f253109181900360200190a150565b60606002805480602002602001604051908101604052809291908181526020018280548015610aec57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610ac1575b5050505050905090565b610afe610c57565b73ffffffffffffffffffffffffffffffffffffffff8116610b2957610b246107bd61120d565b6106a8565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000610ba3611244565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054610bd383826110cc565b92915050565b60035473ffffffffffffffffffffffffffffffffffffffff163314610c0457610c046107bd33611271565b565b60035474010000000000000000000000000000000000000000900460ff1615610c0457610c046107bd6112f4565b600082820183811015610c5057610c506107bd6000868661132b565b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c0457600054610c04906107bd90339073ffffffffffffffffffffffffffffffffffffffff166113ca565b73ffffffffffffffffffffffffffffffffffffffff8116610cc457610cc46107bd611456565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff1615610cfe57610cfe6107bd8261148d565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b3360009081526001602052604090205460ff16610c0457610c046107bd33611510565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167feb5108a200000000000000000000000000000000000000000000000000000000179052919050565b805160208201fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610eb657610eb66107bd83610df2565b6002548110610ed157610ed16107bd82600280549050611593565b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110610ef557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610f5757610f576107bd60028381548110610f2f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1684611606565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610fd257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061100557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061108490826116e8565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054611102908263ffffffff61169216565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604091829020939093558051848152905191927f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436492918290030190a2600654604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b505050506040513d602081101561120757600080fd5b50505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b60035474010000000000000000000000000000000000000000900460ff16610c0457610c046107bd6116b1565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fca1d07a200000000000000000000000000000000000000000000000000000000179052919050565b60408051808201909152600481527f7dd020ce00000000000000000000000000000000000000000000000000000000602082015290565b606063e946c1bb60e01b8484846040516024018084600381111561134b57fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1de45ad10000000000000000000000000000000000000000000000000000000017905292915050565b60408051808201909152600481527f57654fe400000000000000000000000000000000000000000000000000000000602082015290565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fde16f1a000000000000000000000000000000000000000000000000000000000179052919050565b6040805173ffffffffffffffffffffffffffffffffffffffff83166024808301919091528251808303909101815260449091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fb65a25b900000000000000000000000000000000000000000000000000000000179052919050565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe9f837710000000000000000000000000000000000000000000000000000000017905292915050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f140a84db0000000000000000000000000000000000000000000000000000000017905292915050565b6000828211156116ab576116ab6107bd6002858561132b565b50900390565b60408051808201909152600481527f3ef081cc00000000000000000000000000000000000000000000000000000000602082015290565b81548183558181111561170c5760008381526020902061170c918101908301611711565b505050565b61093491905b8082111561172b5760008155600101611717565b509056fea265627a7a7231582076aa219cd66c1764c8a7c96df5b96bdd788590bf2a082860417fc45b656de06664736f6c634300050c0032" diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts index d50a9c0ea3..9b565b5f11 100644 --- a/packages/contract-artifacts/src/index.ts +++ b/packages/contract-artifacts/src/index.ts @@ -1,42 +1,30 @@ +import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json'; import * as Coordinator from '../artifacts/Coordinator.json'; import * as CoordinatorRegistry from '../artifacts/CoordinatorRegistry.json'; import * as DevUtils from '../artifacts/DevUtils.json'; -import * as Exchange from '../artifacts/Exchange.json'; -import * as Forwarder from '../artifacts/Forwarder.json'; - -import * as Staking from '../artifacts/Staking.json'; -import * as WETH9 from '../artifacts/WETH9.json'; - -// Order Utils -import * as IValidator from '../artifacts/IValidator.json'; -import * as IWallet from '../artifacts/IWallet.json'; - -// Tokens (allowances, transfers, events) -import * as ERC20Token from '../artifacts/ERC20Token.json'; -import * as ERC721Token from '../artifacts/ERC721Token.json'; - -// Migrations Testnet/Ganache -import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json'; import * as DummyERC20Token from '../artifacts/DummyERC20Token.json'; import * as DummyERC721Token from '../artifacts/DummyERC721Token.json'; -import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json'; -import * as StakingProxy from '../artifacts/StakingProxy.json'; -import * as TestStaking from '../artifacts/TestStaking.json'; -import * as ZrxVault from '../artifacts/ZrxVault.json'; - -// Proxies (Migrations) -import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json'; -import * as ERC20BridgeProxy from '../artifacts/ERC20BridgeProxy.json'; -import * as ERC20Proxy from '../artifacts/ERC20Proxy.json'; -import * as ERC721Proxy from '../artifacts/ERC721Proxy.json'; -import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json'; -import * as StaticCallProxy from '../artifacts/StaticCallProxy.json'; - -// Unknown/Unused import * as DutchAuction from '../artifacts/DutchAuction.json'; +import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json'; +import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json'; +import * as ERC20Proxy from '../artifacts/ERC20Proxy.json'; +import * as ERC20Token from '../artifacts/ERC20Token.json'; +import * as ERC721Proxy from '../artifacts/ERC721Proxy.json'; +import * as ERC721Token from '../artifacts/ERC721Token.json'; +import * as Exchange from '../artifacts/Exchange.json'; +import * as Forwarder from '../artifacts/Forwarder.json'; import * as IAssetProxy from '../artifacts/IAssetProxy.json'; +import * as IValidator from '../artifacts/IValidator.json'; +import * as IWallet from '../artifacts/IWallet.json'; +import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json'; import * as OrderValidator from '../artifacts/OrderValidator.json'; +import * as Staking from '../artifacts/Staking.json'; +import * as StakingProxy from '../artifacts/StakingProxy.json'; +import * as StaticCallProxy from '../artifacts/StaticCallProxy.json'; +import * as WETH9 from '../artifacts/WETH9.json'; import * as ZRXToken from '../artifacts/ZRXToken.json'; +import * as ERC20BridgeProxy from '../artifacts/ERC20BridgeProxy.json'; +import * as ZrxVault from '../artifacts/ZrxVault.json'; export { AssetProxyOwner, @@ -65,6 +53,5 @@ export { CoordinatorRegistry, Staking, StakingProxy, - TestStaking, ZrxVault, }; diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json index a8e7b480d1..d08dfa6baf 100644 --- a/packages/contract-artifacts/tsconfig.json +++ b/packages/contract-artifacts/tsconfig.json @@ -32,7 +32,6 @@ "./artifacts/StaticCallProxy.json", "./artifacts/Staking.json", "./artifacts/StakingProxy.json", - "./artifacts/TestStaking.json", "./artifacts/ZrxVault.json", "./artifacts/ERC20BridgeProxy.json" ] diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index e956bfe4f2..7d7d084f30 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Migrations script no longer deploys DutchAuction since it is not yet upgraded for V3 of the protocol", "pr": 2324 + }, + { + "note": "Added `Staking` and `ERC20BridgeProxy` contracts", + "pr": 2323 } ] }, diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 715cf823a9..88a78dcb3f 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -1,21 +1,22 @@ -import { CoordinatorContract, OrderValidatorContract, ZrxVaultContract } from '@0x/abi-gen-wrappers'; +import { CoordinatorContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; import * as artifacts from '@0x/contract-artifacts'; import { ERC1155ProxyContract, + ERC20BridgeProxyContract, ERC20ProxyContract, ERC721ProxyContract, MultiAssetProxyContract, StaticCallProxyContract, - ERC20BridgeProxyContract, } from '@0x/contracts-asset-proxy'; import { CoordinatorRegistryContract } from '@0x/contracts-coordinator'; import { DevUtilsContract } from '@0x/contracts-dev-utils'; import { ERC1155MintableContract } from '@0x/contracts-erc1155'; -import { DummyERC20TokenContract, WETH9Contract, ZRXTokenContract } from '@0x/contracts-erc20'; +import { DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20'; import { DummyERC721TokenContract } from '@0x/contracts-erc721'; import { ExchangeContract } from '@0x/contracts-exchange'; import { ForwarderContract } from '@0x/contracts-exchange-forwarder'; +import { StakingProxyContract, TestStakingContract, ZrxVaultContract } from '@0x/contracts-staking'; import { Web3ProviderEngine } from '@0x/subproviders'; import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; @@ -23,7 +24,6 @@ import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types'; import { constants } from './utils/constants'; import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info'; -import { TestStakingContract, StakingProxyContract } from '@0x/contracts-staking'; // HACK (xianny): Copied from @0x/order-utils to get rid of circular dependency /** @@ -99,8 +99,6 @@ export async function runMigrationsAsync( const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults, artifacts); // Exchange - // tslint:disable-next-line:no-unused-variable - const zrxAssetData = encodeERC20AssetData(zrxToken.address); const exchange = await ExchangeContract.deployFrom0xArtifactAsync( artifacts.Exchange, provider, @@ -189,42 +187,6 @@ export async function runMigrationsAsync( encodeERC20AssetData(etherToken.address), ); - // TODO (xianny): figure out how to deploy AssetProxyOwnerContract properly - // // Multisigs - // const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync(); - // const owners = _.uniq([accounts[0], accounts[1], txDefaults.from]); - // const confirmationsRequired = new BigNumber(2); - // const secondsRequired = new BigNumber(0); - - // // AssetProxyOwner - - // const assetProxyOwner = await AssetProxyOwnerContract.deployFrom0xArtifactAsync( - // artifacts.AssetProxyOwner, - // provider, - // txDefaults, - // artifacts, - // [], - // [erc20Proxy.address, erc721Proxy.address, multiAssetProxy.address], - // [], - // owners, - // confirmationsRequired, - // secondsRequired, - // ); - - // // Transfer Ownership to the Asset Proxy Owner - // await web3Wrapper.awaitTransactionSuccessAsync( - // await erc20Proxy.transferOwnership(assetProxyOwner.address).sendTransactionAsync(txDefaults), - // ); - // await web3Wrapper.awaitTransactionSuccessAsync( - // await erc721Proxy.transferOwnership(assetProxyOwner.address).sendTransactionAsync(txDefaults), - // ); - // await web3Wrapper.awaitTransactionSuccessAsync( - // await erc1155Proxy.transferOwnership(assetProxyOwner.address).sendTransactionAsync(txDefaults), - // ); - // await web3Wrapper.awaitTransactionSuccessAsync( - // await multiAssetProxy.transferOwnership(assetProxyOwner.address).sendTransactionAsync(txDefaults), - // ); - // Fake the above transactions so our nonce increases and we result with the same addresses // while AssetProxyOwner is disabled (TODO: @dekz remove) const dummyTransactionCount = 8; @@ -326,7 +288,6 @@ export async function runMigrationsAsync( zrxToken: zrxToken.address, etherToken: etherToken.address, exchange: exchange.address, - // TODO (xianny): figure out how to deploy AssetProxyOwnerContract assetProxyOwner: constants.NULL_ADDRESS, erc20BridgeProxy: erc20BridgeProxy.address, zeroExGovernor: constants.NULL_ADDRESS,