From b4b43a9e9ebb0fded51c9e5291d7091791f04239 Mon Sep 17 00:00:00 2001 From: Greg Hysz Date: Sat, 16 Nov 2019 16:22:22 -0800 Subject: [PATCH] Updated Coordinator wrappers and artifacts (#2346) * Updated Coordinator wrappers and artifacts * Use contracts-coordinator package for Coordinator * disable custom CoordinatorWrapper * trim disallowed artifact fields; fix exports for docs; lint --- packages/abi-gen-wrappers/CHANGELOG.json | 4 + .../src/generated-wrappers/coordinator.ts | 859 +++++----- .../coordinator_registry.ts | 181 +- packages/contract-artifacts/CHANGELOG.json | 4 + .../artifacts/Coordinator.json | 271 +-- .../artifacts/CoordinatorRegistry.json | 76 +- .../artifacts/ZrxVault.json | 34 +- .../src/contract_wrappers.ts | 14 +- .../src/coordinator_wrapper.ts | 1456 ++++++++--------- packages/contract-wrappers/src/index.ts | 6 - .../test/coordinator_wrapper_test.ts | 1268 +++++++------- packages/migrations/src/migration.ts | 4 +- 12 files changed, 2165 insertions(+), 2012 deletions(-) diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index 63054c7c58..97f4e7e588 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -9,6 +9,10 @@ { "note": "[Breaking] Big refactor of contract wrapper interface. See https://github.com/0xProject/0x-monorepo/pull/2325 for details", "pr": 2325 + }, + { + "note": "Updated Coordinator + Coordinator Registry wrappers", + "pr": 2346 } ] }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 66167d9d99..d3cfe3e14f 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -39,14 +39,16 @@ export class CoordinatorContract extends BaseContract { /** * @ignore */ - public static deployedBytecode: string | undefined; + public static deployedBytecode = + '0x6080604052600436106100b15760003560e01c8063da4fe07411610069578063ee55b9681161004e578063ee55b9681461018a578063fb6961cc146101b7578063fdd059a5146101cc576100b1565b8063da4fe07414610162578063e1c7157814610175576100b1565b806389fab5b71161009a57806389fab5b714610109578063b2562b7a1461012b578063c26cfecd14610140576100b1565b80630f7d8e39146100b357806352813679146100e9575b005b3480156100bf57600080fd5b506100d36100ce3660046116c2565b6101ec565b6040516100e09190611a15565b60405180910390f35b3480156100f557600080fd5b506100b1610104366004611889565b610455565b34801561011557600080fd5b5061011e610482565b6040516100e09190611c41565b34801561013757600080fd5b5061011e6104bb565b34801561014c57600080fd5b506101556104f4565b6040516100e09190611ba2565b6100b1610170366004611889565b6104fa565b34801561018157600080fd5b506101556105e8565b34801561019657600080fd5b506101aa6101a5366004611707565b61060c565b6040516100e09190611a36565b3480156101c357600080fd5b50610155610ac0565b3480156101d857600080fd5b506101556101e7366004611775565b610ac6565b80516000908061020a5761020a61020560008686610ad9565b610b7e565b60008360018551038151811061021c57fe5b016020015160f81c90506008811061023d5761023d61020560018787610ad9565b60008160ff16600881111561024e57fe5b9050600081600881111561025e57fe5b14156102785761027361020560028888610ad9565b61043c565b600181600881111561028657fe5b141561029b5761027361020560038888610ad9565b60028160088111156102a957fe5b141561038557826042146102c6576102c661020560008888610ad9565b6000856000815181106102d557fe5b016020015160f81c905060006102f287600163ffffffff610b8616565b9050600061030788602163ffffffff610b8616565b90506001898484846040516000815260200160405260405161032c9493929190611bcf565b6020604051602081039080840390855afa15801561034e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00151975061044f9650505050505050565b600381600881111561039357fe5b141561043c57826042146103b0576103b061020560008888610ad9565b6000856000815181106103bf57fe5b016020015160f81c905060006103dc87600163ffffffff610b8616565b905060006103f188602163ffffffff610b8616565b905060018960405160200161040691906119e4565b604051602081830303815290604052805190602001208484846040516000815260200160405260405161032c9493929190611bcf565b61044b61020560018888610ad9565b5050505b92915050565b6060610464856080015161060c565b80519091501561047b5761047b8582868686610bb0565b5050505050565b6040518060400160405280601781526020017f30782050726f746f636f6c20436f6f7264696e61746f7200000000000000000081525081565b6040518060400160405280600581526020017f332e302e3000000000000000000000000000000000000000000000000000000081525081565b60015481565b61050684848484610455565b6002546040517f2280c9100000000000000000000000000000000000000000000000000000000081526201000090910473ffffffffffffffffffffffffffffffffffffffff1690632280c9109034906105659088908790600401611c54565b6000604051808303818588803b15801561057e57600080fd5b505af1158015610592573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526105d99190810190611742565b506105e2610d5d565b50505050565b7fa6511c04ca44625d50986f8c36bedc09366207a17b96e347094053a9f850716881565b60606000610620838263ffffffff610d7316565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167f9b44d5560000000000000000000000000000000000000000000000000000000014806106b357507fffffffff0000000000000000000000000000000000000000000000000000000081167fe14b58c400000000000000000000000000000000000000000000000000000000145b1561073c576106c06112e6565b83516106d690859060049063ffffffff610dbf16565b8060200190516106e991908101906117ff565b604080516001808252818301909252919250816020015b6107086112e6565b815260200190600190039081610700579050509250808360008151811061072b57fe5b602002602001018190525050610aba565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f9694a4020000000000000000000000000000000000000000000000000000000014806107cd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f8ea8dfe400000000000000000000000000000000000000000000000000000000145b8061081957507fffffffff0000000000000000000000000000000000000000000000000000000081167fbeee2e1400000000000000000000000000000000000000000000000000000000145b8061086557507fffffffff0000000000000000000000000000000000000000000000000000000081167f78d29ac100000000000000000000000000000000000000000000000000000000145b806108b157507fffffffff0000000000000000000000000000000000000000000000000000000081167f8bc8efb300000000000000000000000000000000000000000000000000000000145b806108fd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f369da09900000000000000000000000000000000000000000000000000000000145b8061094957507fffffffff0000000000000000000000000000000000000000000000000000000081167fa6c3bf3300000000000000000000000000000000000000000000000000000000145b1561097e57825161096490849060049063ffffffff610dbf16565b8060200190516109779190810190611636565b9150610aba565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f88ec79fb000000000000000000000000000000000000000000000000000000001480610a0f57507fffffffff0000000000000000000000000000000000000000000000000000000081167fb718e29200000000000000000000000000000000000000000000000000000000145b15610aba57610a1c6112e6565b610a246112e6565b8451610a3a90869060049063ffffffff610dbf16565b806020019051610a4d9190810190611832565b60408051600280825260608201909252929450909250816020015b610a706112e6565b815260200190600190039081610a685790505093508184600081518110610a9357fe5b60200260200101819052508084600181518110610aac57fe5b602002602001018190525050505b50919050565b60005481565b600061044f610ad483610e46565b610e99565b606063779c522360e01b848484604051602401610af893929190611c0f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b805160208201fd5b60008160200183511015610ba757610ba76102056005855185602001610ea7565b50016020015190565b3273ffffffffffffffffffffffffffffffffffffffff841614610bd957610bd961020584610ec6565b6000610be786600154610f65565b60408051600080825260208201909252845192935091905b818114610c9057610c0e6113ad565b60405180606001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018881525090506000610c4c82610ac6565b90506000610c6d82898681518110610c6057fe5b60200260200101516101ec565b9050610c7f868263ffffffff610f7916565b95505060019092019150610bff9050565b50610ca1823263ffffffff610f7916565b875190925060005b818114610d5157600073ffffffffffffffffffffffffffffffffffffffff16898281518110610cd457fe5b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff161415610d0157610d49565b6000898281518110610d0f57fe5b60200260200101516040015190506000610d32828761101b90919063ffffffff16565b905080610d4657610d466102058884611053565b50505b600101610ca9565b50505050505050505050565b610d656110f5565b610d7157610d71611103565b565b60008160040183511015610d9457610d946102056003855185600401610ea7565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b606081831115610dd857610dd861020560008585610ea7565b8351821115610df157610df16102056001848751610ea7565b8282036040519080825280601f01601f191660200182016040528015610e1e576020820181803883390190505b509050610e3f610e2d8261113d565b84610e378761113d565b018351611143565b9392505050565b604081810151825160209384015182519285019290922083517fa6511c04ca44625d50986f8c36bedc09366207a17b96e347094053a9f85071688152948501919091529183015260608201526080902090565b600061044f60005483611207565b6060632800659560e01b848484604051602401610af893929190611bed565b606063a458d7ff60e01b82604051602401610ee19190611a15565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b6000610e3f82610f7485611241565b611207565b815160405160609184906020808202808401820192910182851015610fa557610fa561020586856112c9565b82851115610fbf57610fb8858583611143565b8497508793505b60018201915060208101905080840192508294508188528460405286886001840381518110610fea57fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015250959695505050505050565b60006020835102602084018181018192505b8083101561044b5782518086141561104757600194508193505b5060208301925061102d565b606063d789b64060e01b8383604051602401611070929190611bab565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b600254610100900460ff1690565b3031801561113a57604051339082156108fc029083906000818181858888f19350505050158015611138573d6000803e3d6000fd5b505b50565b60200190565b602081101561116d576001816020036101000a038019835116818551168082178652505050611202565b8282141561117a57611202565b828211156111b45760208103905080820181840181515b828510156111ac578451865260209586019590940193611191565b905250611202565b60208103905080820181840183515b818612156111fd57825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe092830192909101906111c3565b855250505b505050565b6040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b608081810151825160208085015160408087015160609788015186519685019690962082517fec69816980a3a3ca4554410e60253953e9ff375ba4536a98adfa15cc71541508815294850195909552908301919091529481019490945273ffffffffffffffffffffffffffffffffffffffff9091169183019190915260a082015260c0902090565b6060635fc8372260e01b8383604051602401611070929190611cca565b604051806101c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6040805160608082018352600080835260208301529181019190915290565b803561044f81611d8d565b805161044f81611d8d565b600082601f8301126113f2578081fd5b813561140561140082611cff565b611cd8565b8181529150602080830190840160005b838110156114425761142d876020843589010161144c565b83526020928301929190910190600101611415565b5050505092915050565b600082601f83011261145c578081fd5b813561146a61140082611d1f565b915080825283602082850101111561148157600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126114aa578081fd5b81516114b861140082611d1f565b91508082528360208285010111156114cf57600080fd5b6114e0816020840160208601611d61565b5092915050565b60006101c08083850312156114fa578182fd5b61150381611cd8565b91505061151083836113d7565b815261151f83602084016113d7565b602082015261153183604084016113d7565b604082015261154383606084016113d7565b60608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201526101008083015181830152506101208083015181830152506101408083015167ffffffffffffffff808211156115a557600080fd5b6115b18683870161149a565b838501526101609250828501519150808211156115cd57600080fd5b6115d98683870161149a565b838501526101809250828501519150808211156115f557600080fd5b6116018683870161149a565b838501526101a092508285015191508082111561161d57600080fd5b5061162a8582860161149a565b82840152505092915050565b60006020808385031215611648578182fd5b825167ffffffffffffffff81111561165e578283fd5b80840185601f82011261166f578384fd5b8051915061167f61140083611cff565b82815283810190828501865b858110156116b4576116a28a8884518801016114e7565b8452928601929086019060010161168b565b509098975050505050505050565b600080604083850312156116d4578081fd5b82359150602083013567ffffffffffffffff8111156116f1578182fd5b6116fd8582860161144c565b9150509250929050565b600060208284031215611718578081fd5b813567ffffffffffffffff81111561172e578182fd5b61173a8482850161144c565b949350505050565b600060208284031215611753578081fd5b815167ffffffffffffffff811115611769578182fd5b61173a8482850161149a565b600060208284031215611786578081fd5b813567ffffffffffffffff8082111561179d578283fd5b818401606081870312156117af578384fd5b6117b96060611cd8565b925080356117c681611d8d565b8352602081810135908401526040810135828111156117e3578485fd5b6117ef8782840161144c565b6040850152509195945050505050565b600060208284031215611810578081fd5b815167ffffffffffffffff811115611826578182fd5b61173a848285016114e7565b60008060408385031215611844578182fd5b825167ffffffffffffffff8082111561185b578384fd5b611867868387016114e7565b9350602085015191508082111561187c578283fd5b506116fd858286016114e7565b6000806000806080858703121561189e578182fd5b843567ffffffffffffffff808211156118b5578384fd5b81870160a0818a0312156118c7578485fd5b6118d160a0611cd8565b92508035835260208101356020840152604081013560408401526118f889606083016113cc565b606084015260808101358281111561190e578586fd5b61191a8a82840161144c565b6080850152505081955061193188602089016113cc565b94506040870135915080821115611946578384fd5b6119528883890161144c565b93506060870135915080821115611967578283fd5b50611974878288016113e2565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff169052565b600081518084526119b2816020860160208601611d61565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015611b95577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845281516101c0611a9a878351611980565b87820151611aaa89890182611980565b506040820151611abd6040890182611980565b506060820151611ad06060890182611980565b506080820151608088015260a082015160a088015260c082015160c088015260e082015160e08801526101008083015181890152506101208083015181890152506101408083015182828a0152611b29838a018261199a565b915050610160915081830151888203838a0152611b46828261199a565b9250505061018080830151888303828a0152611b62838261199a565b9150506101a0915081830151888203838a0152611b7f828261199a565b9850505094870194505090850190600101611a5b565b5092979650505050505050565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b93845260ff9290921660208401526040830152606082015260800190565b6060810160088510611bfb57fe5b938152602081019290925260409091015290565b600060048510611c1b57fe5b84825283602083015260606040830152611c38606083018461199a565b95945050505050565b600060208252610e3f602083018461199a565b60006040825283516040830152602084015160608301526040840151608083015273ffffffffffffffffffffffffffffffffffffffff60608501511660a0830152608084015160a060c0840152611cae60e084018261199a565b8381036020850152611cc0818661199a565b9695505050505050565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715611cf757600080fd5b604052919050565b600067ffffffffffffffff821115611d15578081fd5b5060209081020190565b600067ffffffffffffffff821115611d35578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015611d7c578181015183820152602001611d64565b838111156105e25750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461113a57600080fd5b8351602094850120835193850193909320604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815295860194909452928401929092526060830152608082015260a090209056fea365627a7a72315820efc81773b7912bf9e2c93c985afa2b6feee69452023986811fc84107b08ecc776c6578706572696d656e74616cf564736f6c634300050d0040'; private readonly _methodABIIndex: { [name: string]: number } = {}; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _exchange: string, + exchange: string, + chainId: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -71,7 +73,8 @@ export class CoordinatorContract extends BaseContract { provider, txDefaults, logDecodeDependenciesAbiOnly, - _exchange, + exchange, + chainId, ); } public static async deployAsync( @@ -80,7 +83,8 @@ export class CoordinatorContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + exchange: string, + chainId: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -90,14 +94,14 @@ export class CoordinatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange] = BaseContract._formatABIDataItemList( + [exchange, chainId] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange], + [exchange, chainId], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange]); + const txData = deployInfo.encode(bytecode, [exchange, chainId]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { data: txData }, @@ -114,7 +118,7 @@ export class CoordinatorContract extends BaseContract { txDefaults, logDecodeDependencies, ); - contractInstance.constructorArgs = [_exchange]; + contractInstance.constructorArgs = [exchange, chainId]; return contractInstance; } @@ -124,140 +128,82 @@ export class CoordinatorContract extends BaseContract { public static ABI(): ContractAbi { const abi = [ { - constant: true, inputs: [ { - name: 'hash', - type: 'bytes32', - }, - { - name: 'signature', - type: 'bytes', - }, - ], - name: 'getSignerAddress', - outputs: [ - { - name: 'signerAddress', - type: 'address', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'transaction', - type: 'tuple', - components: [ - { - name: 'salt', - type: 'uint256', - }, - { - name: 'signerAddress', - type: 'address', - }, - { - name: 'data', - type: 'bytes', - }, - ], - }, - ], - name: 'getTransactionHash', - outputs: [ - { - name: 'transactionHash', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'approval', - type: 'tuple', - components: [ - { - name: 'txOrigin', - type: 'address', - }, - { - name: 'transactionHash', - type: 'bytes32', - }, - { - name: 'transactionSignature', - type: 'bytes', - }, - { - name: 'approvalExpirationTimeSeconds', - type: 'uint256', - }, - ], - }, - ], - name: 'getCoordinatorApprovalHash', - outputs: [ - { - name: 'approvalHash', - type: 'bytes32', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'transaction', - type: 'tuple', - components: [ - { - name: 'salt', - type: 'uint256', - }, - { - name: 'signerAddress', - type: 'address', - }, - { - name: 'data', - type: 'bytes', - }, - ], - }, - { - name: 'txOrigin', + name: 'exchange', type: 'address', }, { - name: 'transactionSignature', - type: 'bytes', - }, - { - name: 'approvalExpirationTimeSeconds', - type: 'uint256[]', - }, - { - name: 'approvalSignatures', - type: 'bytes[]', + name: 'chainId', + type: 'uint256', }, ], - name: 'executeTransaction', outputs: [], payable: false, stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'fallback', + }, + { + constant: true, + inputs: [], + name: 'EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'EIP712_COORDINATOR_DOMAIN_HASH', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'EIP712_COORDINATOR_DOMAIN_NAME', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'EIP712_COORDINATOR_DOMAIN_VERSION', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', type: 'function', }, { @@ -285,6 +231,14 @@ export class CoordinatorContract extends BaseContract { name: 'salt', type: 'uint256', }, + { + name: 'expirationTimeSeconds', + type: 'uint256', + }, + { + name: 'gasPrice', + type: 'uint256', + }, { name: 'signerAddress', type: 'address', @@ -303,10 +257,6 @@ export class CoordinatorContract extends BaseContract { name: 'transactionSignature', type: 'bytes', }, - { - name: 'approvalExpirationTimeSeconds', - type: 'uint256[]', - }, { name: 'approvalSignatures', type: 'bytes[]', @@ -380,6 +330,14 @@ export class CoordinatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, + { + name: 'makerFeeAssetData', + type: 'bytes', + }, + { + name: 'takerFeeAssetData', + type: 'bytes', + }, ], }, ], @@ -387,13 +345,80 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'pure', type: 'function', }, + { + constant: false, + inputs: [ + { + name: 'transaction', + type: 'tuple', + components: [ + { + name: 'salt', + type: 'uint256', + }, + { + name: 'expirationTimeSeconds', + type: 'uint256', + }, + { + name: 'gasPrice', + type: 'uint256', + }, + { + name: 'signerAddress', + type: 'address', + }, + { + name: 'data', + type: 'bytes', + }, + ], + }, + { + name: 'txOrigin', + type: 'address', + }, + { + name: 'transactionSignature', + type: 'bytes', + }, + { + name: 'approvalSignatures', + type: 'bytes[]', + }, + ], + name: 'executeTransaction', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, { constant: true, - inputs: [], - name: 'EIP712_COORDINATOR_DOMAIN_HASH', + inputs: [ + { + name: 'approval', + type: 'tuple', + components: [ + { + name: 'txOrigin', + type: 'address', + }, + { + name: 'transactionHash', + type: 'bytes32', + }, + { + name: 'transactionSignature', + type: 'bytes', + }, + ], + }, + ], + name: 'getCoordinatorApprovalHash', outputs: [ { - name: '', + name: 'approvalHash', type: 'bytes32', }, ], @@ -402,16 +427,27 @@ export class CoordinatorContract extends BaseContract { type: 'function', }, { + constant: true, inputs: [ { - name: '_exchange', + name: 'hash', + type: 'bytes32', + }, + { + name: 'signature', + type: 'bytes', + }, + ], + name: 'getSignerAddress', + outputs: [ + { + name: 'signerAddress', type: 'address', }, ], - outputs: [], payable: false, - stateMutability: 'nonpayable', - type: 'constructor', + stateMutability: 'pure', + type: 'function', }, ] as ContractAbi; return abi; @@ -444,63 +480,7 @@ export class CoordinatorContract extends BaseContract { return abiEncoder.getSelector(); } - /** - * Recovers the address of a signer given a hash and signature. - * @param hash Any 32 byte hash. - * @param signature Proof that the hash has been signed by signer. - */ - public getSignerAddress(hash: string, signature: string): ContractFunctionObj { - const self = (this as any) as CoordinatorContract; - assert.isString('hash', hash); - assert.isString('signature', signature); - - return { - 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 encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); - let rawCallResult; - - const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex'); - try { - rawCallResult = await self._evmExecAsync(encodedDataBytes); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - getABIEncodedTransactionData(): string { - const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [ - hash, - signature, - ]); - return abiEncodedTransactionData; - }, - }; - } - /** - * Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract. - * @param transaction 0x transaction containing salt, signerAddress, and data. - * @returns EIP712 hash of the transaction with the domain separator of this contract. - */ - public getTransactionHash(transaction: { - salt: BigNumber; - signerAddress: string; - data: string; - }): ContractFunctionObj { + public EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH(): ContractFunctionObj { const self = (this as any) as CoordinatorContract; return { @@ -513,9 +493,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ - transaction, - ]); + const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH()', []); let rawCallResult; const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -537,7 +515,7 @@ export class CoordinatorContract extends BaseContract { } BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); + const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming @@ -545,25 +523,14 @@ export class CoordinatorContract extends BaseContract { }, getABIEncodedTransactionData(): string { const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTransactionHash((uint256,address,bytes))', - [transaction], + 'EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH()', + [], ); return abiEncodedTransactionData; }, }; } - /** - * Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract. - * @param approval Coordinator approval message containing the transaction - * hash, transaction signature, and expiration of the approval. - * @returns EIP712 hash of the Coordinator approval message with the domain separator of this contract. - */ - public getCoordinatorApprovalHash(approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }): ContractFunctionObj { + public EIP712_COORDINATOR_DOMAIN_HASH(): ContractFunctionObj { const self = (this as any) as CoordinatorContract; return { @@ -576,10 +543,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const encodedData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); let rawCallResult; const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -601,127 +565,23 @@ export class CoordinatorContract extends BaseContract { } BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - ); + const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData(): string { - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; } - /** - * Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata. - * @param transaction 0x transaction containing salt, signerAddress, and data. - * @param txOrigin Required signer of Ethereum transaction calling this - * function. - * @param transactionSignature Proof that the transaction has been signed by - * the signer. - * @param approvalExpirationTimeSeconds Array of expiration times in seconds - * for which each corresponding approval signature expires. - * @param approvalSignatures Array of signatures that correspond to the - * feeRecipients of each order in the transaction's Exchange calldata. - */ - public executeTransaction( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): ContractTxFunctionObj { + public EIP712_COORDINATOR_DOMAIN_NAME(): ContractFunctionObj { const self = (this as any) as CoordinatorContract; - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); - 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 this.callAsync(txDataWithDefaults); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - const txHashPromise = this.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, - ); - })(), - ); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); - 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; - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -730,16 +590,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_NAME()', []); let rawCallResult; const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -761,24 +612,63 @@ export class CoordinatorContract extends BaseContract { } BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_NAME()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + getABIEncodedTransactionData(): string { + const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_NAME()', []); + return abiEncodedTransactionData; + }, + }; + } + public EIP712_COORDINATOR_DOMAIN_VERSION(): ContractFunctionObj { + const self = (this as any) as CoordinatorContract; + + return { + 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 encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_VERSION()', []); + let rawCallResult; + + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_VERSION()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData(): string { const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], + 'EIP712_COORDINATOR_DOMAIN_VERSION()', + [], ); return abiEncodedTransactionData; }, @@ -839,23 +729,26 @@ export class CoordinatorContract extends BaseContract { * function. * @param transactionSignature Proof that the transaction has been signed by * the signer. - * @param approvalExpirationTimeSeconds Array of expiration times in seconds - * for which each corresponding approval signature expires. * @param approvalSignatures Array of signatures that correspond to the - * feeRecipients of each order in the transaction's Exchange calldata. + * feeRecipients of each order in the transaction's Exchange + * calldata. */ public assertValidCoordinatorApprovals( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: { + salt: BigNumber; + expirationTimeSeconds: BigNumber; + gasPrice: BigNumber; + signerAddress: string; + data: string; + }, txOrigin: string, transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], ): ContractFunctionObj { const self = (this as any) as CoordinatorContract; assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); return { @@ -869,14 +762,8 @@ export class CoordinatorContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const encodedData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], + 'assertValidCoordinatorApprovals((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + [transaction, txOrigin.toLowerCase(), transactionSignature, approvalSignatures], ); let rawCallResult; @@ -900,7 +787,7 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + 'assertValidCoordinatorApprovals((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', ); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -909,14 +796,8 @@ export class CoordinatorContract extends BaseContract { }, getABIEncodedTransactionData(): string { const abiEncodedTransactionData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], + 'assertValidCoordinatorApprovals((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + [transaction, txOrigin.toLowerCase(), transactionSignature, approvalSignatures], ); return abiEncodedTransactionData; }, @@ -925,7 +806,7 @@ export class CoordinatorContract extends BaseContract { /** * Decodes the orders from Exchange calldata representing any fill method. * @param data Exchange calldata representing a fill method. - * @returns The orders from the Exchange calldata. + * @returns orders The orders from the Exchange calldata. */ public decodeOrdersFromFillData( data: string, @@ -943,6 +824,8 @@ export class CoordinatorContract extends BaseContract { salt: BigNumber; makerAssetData: string; takerAssetData: string; + makerFeeAssetData: string; + takerFeeAssetData: string; }> > { const self = (this as any) as CoordinatorContract; @@ -966,6 +849,8 @@ export class CoordinatorContract extends BaseContract { salt: BigNumber; makerAssetData: string; takerAssetData: string; + makerFeeAssetData: string; + takerFeeAssetData: string; }> > { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1004,6 +889,8 @@ export class CoordinatorContract extends BaseContract { salt: BigNumber; makerAssetData: string; takerAssetData: string; + makerFeeAssetData: string; + takerFeeAssetData: string; }> >(rawCallResult); // tslint:enable boolean-naming @@ -1017,11 +904,102 @@ export class CoordinatorContract extends BaseContract { }, }; } - public EIP712_COORDINATOR_DOMAIN_HASH(): ContractFunctionObj { + /** + * Executes a 0x transaction that has been signed by the feeRecipients that correspond to + * each order in the transaction's Exchange calldata. + * @param transaction 0x transaction containing salt, signerAddress, and data. + * @param txOrigin Required signer of Ethereum transaction calling this + * function. + * @param transactionSignature Proof that the transaction has been signed by + * the signer. + * @param approvalSignatures Array of signatures that correspond to the + * feeRecipients of each order in the transaction's Exchange + * calldata. + */ + public executeTransaction( + transaction: { + salt: BigNumber; + expirationTimeSeconds: BigNumber; + gasPrice: BigNumber; + signerAddress: string; + data: string; + }, + txOrigin: string, + transactionSignature: string, + approvalSignatures: string[], + ): ContractTxFunctionObj { const self = (this as any) as CoordinatorContract; + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalSignatures', approvalSignatures); + return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + [transaction, txOrigin.toLowerCase(), transactionSignature, approvalSignatures], + ); + 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 this.callAsync(txDataWithDefaults); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + awaitTransactionSuccessAsync( + txData?: Partial, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, + ): PromiseWithTransactionHash { + const txHashPromise = this.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, + ); + })(), + ); + }, + async estimateGasAsync(txData?: Partial | undefined): Promise { + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + [transaction, txOrigin.toLowerCase(), transactionSignature, approvalSignatures], + ); + 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; + }, + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1030,7 +1008,10 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + [transaction, txOrigin.toLowerCase(), transactionSignature, approvalSignatures], + ); let rawCallResult; const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1052,14 +1033,130 @@ export class CoordinatorContract extends BaseContract { } BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); + const abiEncoder = self._lookupAbiEncoder( + 'executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + ); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + getABIEncodedTransactionData(): string { + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])', + [transaction, txOrigin.toLowerCase(), transactionSignature, approvalSignatures], + ); + return abiEncodedTransactionData; + }, + }; + } + /** + * Calculates the EIP712 hash of the Coordinator approval mesasage using the domain + * separator of this contract. + * @param approval Coordinator approval message containing the transaction + * hash, and transaction signature. + * @returns approvalHash EIP712 hash of the Coordinator approval message with the domain separator of this contract. + */ + public getCoordinatorApprovalHash(approval: { + txOrigin: string; + transactionHash: string; + transactionSignature: string; + }): ContractFunctionObj { + const self = (this as any) as CoordinatorContract; + + return { + 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 encodedData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes))', [ + approval, + ]); + let rawCallResult; + + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes))'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData(): string { - const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getCoordinatorApprovalHash((address,bytes32,bytes))', + [approval], + ); + return abiEncodedTransactionData; + }, + }; + } + /** + * Recovers the address of a signer given a hash and signature. + * @param hash Any 32 byte hash. + * @param signature Proof that the hash has been signed by signer. + * @returns signerAddress Address of the signer. + */ + public getSignerAddress(hash: string, signature: string): ContractFunctionObj { + const self = (this as any) as CoordinatorContract; + assert.isString('hash', hash); + assert.isString('signature', signature); + + return { + 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 encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); + let rawCallResult; + + const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex'); + try { + rawCallResult = await self._evmExecAsync(encodedDataBytes); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + getABIEncodedTransactionData(): string { + const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [ + hash, + signature, + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts index bcb482e3d3..24cacc11d4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -130,39 +130,6 @@ export class CoordinatorRegistryContract extends BaseContract { */ public static ABI(): ContractAbi { const abi = [ - { - constant: false, - inputs: [ - { - name: 'coordinatorEndpoint', - type: 'string', - }, - ], - name: 'setCoordinatorEndpoint', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'coordinatorOperator', - type: 'address', - }, - ], - name: 'getCoordinatorEndpoint', - outputs: [ - { - name: 'coordinatorEndpoint', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, { inputs: [], outputs: [], @@ -188,6 +155,39 @@ export class CoordinatorRegistryContract extends BaseContract { outputs: [], type: 'event', }, + { + constant: true, + inputs: [ + { + name: 'coordinatorOperator', + type: 'address', + }, + ], + name: 'getCoordinatorEndpoint', + outputs: [ + { + name: 'coordinatorEndpoint', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'coordinatorEndpoint', + type: 'string', + }, + ], + name: 'setCoordinatorEndpoint', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, ] as ContractAbi; return abi; } @@ -219,9 +219,66 @@ export class CoordinatorRegistryContract extends BaseContract { return abiEncoder.getSelector(); } + /** + * Gets the endpoint for a Coordinator. + * @param coordinatorOperator Operator of the Coordinator endpoint. + * @returns coordinatorEndpoint Endpoint of the Coordinator as a string. + */ + public getCoordinatorEndpoint(coordinatorOperator: string): ContractFunctionObj { + const self = (this as any) as CoordinatorRegistryContract; + assert.isString('coordinatorOperator', coordinatorOperator); + + return { + 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 encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); + let rawCallResult; + + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + + BaseContract._throwIfCallResultIsRevertError(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + getABIEncodedTransactionData(): string { + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + }; + } /** * Called by a Coordinator operator to set the endpoint of their Coordinator. - * @param coordinatorEndpoint endpoint of the Coordinator. + * @param coordinatorEndpoint Endpoint of the Coordinator as a string. */ public setCoordinatorEndpoint(coordinatorEndpoint: string): ContractTxFunctionObj { const self = (this as any) as CoordinatorRegistryContract; @@ -337,62 +394,6 @@ export class CoordinatorRegistryContract extends BaseContract { }, }; } - /** - * Gets the endpoint for a Coordinator. - * @param coordinatorOperator operator of the Coordinator endpoint. - */ - public getCoordinatorEndpoint(coordinatorOperator: string): ContractFunctionObj { - const self = (this as any) as CoordinatorRegistryContract; - assert.isString('coordinatorOperator', coordinatorOperator); - - return { - 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 encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); - let rawCallResult; - - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - getABIEncodedTransactionData(): string { - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - }; - } /** * Subscribe to an event type emitted by the CoordinatorRegistry contract. diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json index a24d2e46f1..2a4a4f5e1b 100644 --- a/packages/contract-artifacts/CHANGELOG.json +++ b/packages/contract-artifacts/CHANGELOG.json @@ -9,6 +9,10 @@ { "note": "Added `ZrxVault` and `ERC20BridgeProxy` artifacts", "pr": 2323 + }, + { + "note": "Updated Coordinator + Coordinator Registry artifacts", + "pr": 2346 } ] }, diff --git a/packages/contract-artifacts/artifacts/Coordinator.json b/packages/contract-artifacts/artifacts/Coordinator.json index b65fe37e45..ac657fcd08 100644 --- a/packages/contract-artifacts/artifacts/Coordinator.json +++ b/packages/contract-artifacts/artifacts/Coordinator.json @@ -4,81 +4,56 @@ "compilerOutput": { "abi": [ { - "constant": true, - "inputs": [{ "name": "hash", "type": "bytes32" }, { "name": "signature", "type": "bytes" }], - "name": "getSignerAddress", - "outputs": [{ "name": "signerAddress", "type": "address" }], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, "inputs": [ - { - "components": [ - { "name": "salt", "type": "uint256" }, - { "name": "signerAddress", "type": "address" }, - { "name": "data", "type": "bytes" } - ], - "name": "transaction", - "type": "tuple" - } + { "internalType": "address", "name": "exchange", "type": "address" }, + { "internalType": "uint256", "name": "chainId", "type": "uint256" } ], - "name": "getTransactionHash", - "outputs": [{ "name": "transactionHash", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "components": [ - { "name": "txOrigin", "type": "address" }, - { "name": "transactionHash", "type": "bytes32" }, - { "name": "transactionSignature", "type": "bytes" }, - { "name": "approvalExpirationTimeSeconds", "type": "uint256" } - ], - "name": "approval", - "type": "tuple" - } - ], - "name": "getCoordinatorApprovalHash", - "outputs": [{ "name": "approvalHash", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "components": [ - { "name": "salt", "type": "uint256" }, - { "name": "signerAddress", "type": "address" }, - { "name": "data", "type": "bytes" } - ], - "name": "transaction", - "type": "tuple" - }, - { "name": "txOrigin", "type": "address" }, - { "name": "transactionSignature", "type": "bytes" }, - { "name": "approvalExpirationTimeSeconds", "type": "uint256[]" }, - { "name": "approvalSignatures", "type": "bytes[]" } - ], - "name": "executeTransaction", - "outputs": [], "payable": false, "stateMutability": "nonpayable", + "type": "constructor" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": true, + "inputs": [], + "name": "EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EIP712_COORDINATOR_DOMAIN_HASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EIP712_COORDINATOR_DOMAIN_NAME", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EIP712_COORDINATOR_DOMAIN_VERSION", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "EIP712_EXCHANGE_DOMAIN_HASH", - "outputs": [{ "name": "", "type": "bytes32" }], + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "payable": false, "stateMutability": "view", "type": "function" @@ -88,17 +63,19 @@ "inputs": [ { "components": [ - { "name": "salt", "type": "uint256" }, - { "name": "signerAddress", "type": "address" }, - { "name": "data", "type": "bytes" } + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "uint256", "name": "expirationTimeSeconds", "type": "uint256" }, + { "internalType": "uint256", "name": "gasPrice", "type": "uint256" }, + { "internalType": "address", "name": "signerAddress", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } ], + "internalType": "struct LibZeroExTransaction.ZeroExTransaction", "name": "transaction", "type": "tuple" }, - { "name": "txOrigin", "type": "address" }, - { "name": "transactionSignature", "type": "bytes" }, - { "name": "approvalExpirationTimeSeconds", "type": "uint256[]" }, - { "name": "approvalSignatures", "type": "bytes[]" } + { "internalType": "address", "name": "txOrigin", "type": "address" }, + { "internalType": "bytes", "name": "transactionSignature", "type": "bytes" }, + { "internalType": "bytes[]", "name": "approvalSignatures", "type": "bytes[]" } ], "name": "assertValidCoordinatorApprovals", "outputs": [], @@ -108,24 +85,27 @@ }, { "constant": true, - "inputs": [{ "name": "data", "type": "bytes" }], + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "decodeOrdersFromFillData", "outputs": [ { "components": [ - { "name": "makerAddress", "type": "address" }, - { "name": "takerAddress", "type": "address" }, - { "name": "feeRecipientAddress", "type": "address" }, - { "name": "senderAddress", "type": "address" }, - { "name": "makerAssetAmount", "type": "uint256" }, - { "name": "takerAssetAmount", "type": "uint256" }, - { "name": "makerFee", "type": "uint256" }, - { "name": "takerFee", "type": "uint256" }, - { "name": "expirationTimeSeconds", "type": "uint256" }, - { "name": "salt", "type": "uint256" }, - { "name": "makerAssetData", "type": "bytes" }, - { "name": "takerAssetData", "type": "bytes" } + { "internalType": "address", "name": "makerAddress", "type": "address" }, + { "internalType": "address", "name": "takerAddress", "type": "address" }, + { "internalType": "address", "name": "feeRecipientAddress", "type": "address" }, + { "internalType": "address", "name": "senderAddress", "type": "address" }, + { "internalType": "uint256", "name": "makerAssetAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "takerAssetAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "makerFee", "type": "uint256" }, + { "internalType": "uint256", "name": "takerFee", "type": "uint256" }, + { "internalType": "uint256", "name": "expirationTimeSeconds", "type": "uint256" }, + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "bytes", "name": "makerAssetData", "type": "bytes" }, + { "internalType": "bytes", "name": "takerAssetData", "type": "bytes" }, + { "internalType": "bytes", "name": "makerFeeAssetData", "type": "bytes" }, + { "internalType": "bytes", "name": "takerFeeAssetData", "type": "bytes" } ], + "internalType": "struct LibOrder.Order[]", "name": "orders", "type": "tuple[]" } @@ -134,75 +114,144 @@ "stateMutability": "pure", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "components": [ + { "internalType": "uint256", "name": "salt", "type": "uint256" }, + { "internalType": "uint256", "name": "expirationTimeSeconds", "type": "uint256" }, + { "internalType": "uint256", "name": "gasPrice", "type": "uint256" }, + { "internalType": "address", "name": "signerAddress", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "internalType": "struct LibZeroExTransaction.ZeroExTransaction", + "name": "transaction", + "type": "tuple" + }, + { "internalType": "address", "name": "txOrigin", "type": "address" }, + { "internalType": "bytes", "name": "transactionSignature", "type": "bytes" }, + { "internalType": "bytes[]", "name": "approvalSignatures", "type": "bytes[]" } + ], + "name": "executeTransaction", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, { "constant": true, - "inputs": [], - "name": "EIP712_COORDINATOR_DOMAIN_HASH", - "outputs": [{ "name": "", "type": "bytes32" }], + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "txOrigin", "type": "address" }, + { "internalType": "bytes32", "name": "transactionHash", "type": "bytes32" }, + { "internalType": "bytes", "name": "transactionSignature", "type": "bytes" } + ], + "internalType": "struct LibCoordinatorApproval.CoordinatorApproval", + "name": "approval", + "type": "tuple" + } + ], + "name": "getCoordinatorApprovalHash", + "outputs": [{ "internalType": "bytes32", "name": "approvalHash", "type": "bytes32" }], "payable": false, "stateMutability": "view", "type": "function" }, { - "inputs": [{ "name": "_exchange", "type": "address" }], + "constant": true, + "inputs": [ + { "internalType": "bytes32", "name": "hash", "type": "bytes32" }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "name": "getSignerAddress", + "outputs": [{ "internalType": "address", "name": "signerAddress", "type": "address" }], "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "pure", + "type": "function" } ], "devdoc": { "methods": { - "assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])": { + "assertValidCoordinatorApprovals((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])": { "details": "Validates that the 0x transaction has been approved by all of the feeRecipients that correspond to each order in the transaction's Exchange calldata.", "params": { - "approvalExpirationTimeSeconds": "Array of expiration times in seconds for which each corresponding approval signature expires.", - "approvalSignatures": "Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.", + "approvalSignatures": "Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.", "transaction": "0x transaction containing salt, signerAddress, and data.", "transactionSignature": "Proof that the transaction has been signed by the signer.", "txOrigin": "Required signer of Ethereum transaction calling this function." } }, + "constructor": { + "params": { + "chainId": "Chain ID of the network this contract is deployed on.", + "exchange": "Address of the 0x Exchange contract." + } + }, "decodeOrdersFromFillData(bytes)": { "details": "Decodes the orders from Exchange calldata representing any fill method.", "params": { "data": "Exchange calldata representing a fill method." }, - "return": "The orders from the Exchange calldata." + "return": "orders The orders from the Exchange calldata." }, - "executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])": { - "details": "Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata.", + "executeTransaction((uint256,uint256,uint256,address,bytes),address,bytes,bytes[])": { + "details": "Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata.", "params": { - "approvalExpirationTimeSeconds": "Array of expiration times in seconds for which each corresponding approval signature expires.", - "approvalSignatures": "Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.", + "approvalSignatures": "Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.", "transaction": "0x transaction containing salt, signerAddress, and data.", "transactionSignature": "Proof that the transaction has been signed by the signer.", "txOrigin": "Required signer of Ethereum transaction calling this function." } }, - "getCoordinatorApprovalHash((address,bytes32,bytes,uint256))": { - "details": "Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.", + "getCoordinatorApprovalHash((address,bytes32,bytes))": { + "details": "Calculates the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.", "params": { - "approval": "Coordinator approval message containing the transaction hash, transaction signature, and expiration of the approval." + "approval": "Coordinator approval message containing the transaction hash, and transaction signature." }, - "return": "EIP712 hash of the Coordinator approval message with the domain separator of this contract." + "return": "approvalHash EIP712 hash of the Coordinator approval message with the domain separator of this contract." }, "getSignerAddress(bytes32,bytes)": { "details": "Recovers the address of a signer given a hash and signature.", "params": { "hash": "Any 32 byte hash.", "signature": "Proof that the hash has been signed by signer." - } - }, - "getTransactionHash((uint256,address,bytes))": { - "details": "Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.", - "params": { "transaction": "0x transaction containing salt, signerAddress, and data." }, - "return": "EIP712 hash of the transaction with the domain separator of this contract." + }, + "return": "signerAddress Address of the signer." } } }, "evm": { "bytecode": { - "object": "0x60806040523480156200001157600080fd5b506040516020806200235b833981018060405262000033919081019062000252565b600080546001600160a01b0319166001600160a01b0383161790556040516200005f906020016200029f565b60408051601f1981840301815282825280516020918201208383018352601784527f30782050726f746f636f6c20436f6f7264696e61746f720000000000000000009382019390935281518083018352600581527f312e302e300000000000000000000000000000000000000000000000000000009082015290516200012d92917f626d101e477fd17dd52afb3f9ad9eb016bf60f6e377877f34e8f3ea84c930236917f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c9130910162000284565b60408051601f198184030181529082905280516020918201206001556200015591016200029f565b60408051601f1981840301815282825280516020918201208383018352600b84527f30782050726f746f636f6c0000000000000000000000000000000000000000009382019390935281518083018352600181527f32000000000000000000000000000000000000000000000000000000000000009082015260005491516200023093927ff0f24618f4c4be1e62e026fb039a20ef96f4495294817d1027ffaa6d1f70e61e927fad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5926001600160a01b03909216910162000284565b60408051601f1981840301815291905280516020909101206002555062000360565b6000602082840312156200026557600080fd5b81516001600160a01b03811681146200027d57600080fd5b9392505050565b93845260208401929092526040830152606082015260800190565b7f454950373132446f6d61696e280000000000000000000000000000000000000081527f737472696e67206e616d652c0000000000000000000000000000000000000000600d8201527f737472696e672076657273696f6e2c000000000000000000000000000000000060198201527f6164647265737320766572696679696e67436f6e74726163740000000000000060288201527f2900000000000000000000000000000000000000000000000000000000000000604182015260420190565b611feb80620003706000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063c26cfecd1161005b578063c26cfecd146100fe578063d2df073314610106578063ee55b96814610119578063fb6961cc1461013957610088565b80630f7d8e391461008d57806323872f55146100b657806348a321d6146100d657806390c3bc3f146100e9575b600080fd5b6100a061009b3660046115d7565b610141565b6040516100ad9190611958565b60405180910390f35b6100c96100c436600461177c565b6104d4565b6040516100ad9190611aad565b6100c96100e436600461165b565b6104e7565b6100fc6100f73660046117b1565b6104fa565b005b6100c96105a6565b6100fc6101143660046117b1565b6105ac565b61012c61012736600461161e565b6105db565b6040516100ad9190611979565b6100c9610a8f565b600080825111610186576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611d7d565b60405180910390fd5b600061019183610a95565b60f81c9050600481106101d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611c7b565b60008160ff1660048111156101e157fe5b905060008160048111156101f157fe5b1415610229576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611d46565b600181600481111561023757fe5b14156102a857835115610276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611e48565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611db4565b60028160048111156102b657fe5b14156103bb5783516041146102f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611ad4565b60008460008151811061030657fe5b016020015160f890811c811b901c9050600061032986600163ffffffff610b1816565b9050600061033e87602163ffffffff610b1816565b9050600188848484604051600081526020016040526040516103639493929190611ab6565b6020604051602081039080840390855afa158015610385573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015196506104ce95505050505050565b60038160048111156103c957fe5b141561049c57835160411461040a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611ad4565b60008460008151811061041957fe5b016020015160f890811c811b901c9050600061043c86600163ffffffff610b1816565b9050600061045187602163ffffffff610b1816565b90506001886040516020016104669190611927565b60405160208183030381529060405280519060200120848484604051600081526020016040526040516103639493929190611ab6565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611c7b565b92915050565b60006104ce6104e283610b61565b610bcf565b60006104ce6104f583610bdd565b610c3c565b61050785858585856105ac565b6000548551602087015160408089015190517fbfc8bfce00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9094169363bfc8bfce9361056d93909290918990600401611e7f565b600060405180830381600087803b15801561058757600080fd5b505af115801561059b573d6000803e3d6000fd5b505050505050505050565b60025481565b60606105bb86604001516105db565b8051909150156105d3576105d3868287878787610c4a565b505050505050565b606060006105ef838263ffffffff610e9816565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167fb4be83d500000000000000000000000000000000000000000000000000000000148061068257507fffffffff0000000000000000000000000000000000000000000000000000000081167f3e228bae00000000000000000000000000000000000000000000000000000000145b806106ce57507fffffffff0000000000000000000000000000000000000000000000000000000081167f64a3bc1500000000000000000000000000000000000000000000000000000000145b15610757576106db6111db565b83516106f190859060049063ffffffff610f0316565b80602001905161070491908101906116ed565b604080516001808252818301909252919250816020015b6107236111db565b81526020019060019003908161071b579050509250808360008151811061074657fe5b602002602001018190525050610a89565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f297bb70b0000000000000000000000000000000000000000000000000000000014806107e857507fffffffff0000000000000000000000000000000000000000000000000000000081167f50dde19000000000000000000000000000000000000000000000000000000000145b8061083457507fffffffff0000000000000000000000000000000000000000000000000000000081167f4d0ae54600000000000000000000000000000000000000000000000000000000145b8061088057507fffffffff0000000000000000000000000000000000000000000000000000000081167fe5fa431b00000000000000000000000000000000000000000000000000000000145b806108cc57507fffffffff0000000000000000000000000000000000000000000000000000000081167fa3e2038000000000000000000000000000000000000000000000000000000000145b8061091857507fffffffff0000000000000000000000000000000000000000000000000000000081167f7e1d980800000000000000000000000000000000000000000000000000000000145b8061096457507fffffffff0000000000000000000000000000000000000000000000000000000081167fdd1c7d1800000000000000000000000000000000000000000000000000000000145b1561099957825161097f90849060049063ffffffff610f0316565b806020019051610992919081019061154b565b9150610a89565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f3c28d861000000000000000000000000000000000000000000000000000000001415610a89576109eb6111db565b6109f36111db565b8451610a0990869060049063ffffffff610f0316565b806020019051610a1c9190810190611722565b60408051600280825260608201909252929450909250816020015b610a3f6111db565b815260200190600190039081610a375790505093508184600081518110610a6257fe5b60200260200101819052508084600181518110610a7b57fe5b602002602001018190525050505b50919050565b60015481565b600080825111610ad1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611ce9565b81600183510381518110610ae157fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019092525060f890811c901b90565b60008160200183511015610b58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611c1e565b50016020015190565b604081810151825160209384015182519285019290922083517f213c6f636f3ea94e701c0adf9b2624aa45a6c694f9a292c094f9a81c24b5df4c81529485019190915273ffffffffffffffffffffffffffffffffffffffff9091169183019190915260608201526080902090565b60006104ce60025483610fcf565b604080820151825160208085015160608681015185519584019590952086517f2fbcdbaa76bc7589916958ae919dfbef04d23f6bbf26de6ff317b32c6cc01e058152938401949094529482015292830152608082015260a09020919050565b60006104ce60015483610fcf565b3273ffffffffffffffffffffffffffffffffffffffff851614610c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611cb2565b6000610ca4876104d4565b60408051600080825260208201909252845192935091905b818114610da5576000868281518110610cd157fe5b60200260200101519050610ce3611294565b60405180608001604052808b73ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018a8152602001838152509050428211610d55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611be7565b6000610d60826104e7565b90506000610d81828a8781518110610d7457fe5b6020026020010151610141565b9050610d93878263ffffffff61100916565b96505060019093019250610cbc915050565b50610db6823263ffffffff61100916565b885190925060005b818114610e8b57600073ffffffffffffffffffffffffffffffffffffffff168a8281518110610de957fe5b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff161415610e1657610e83565b60008a8281518110610e2457fe5b60200260200101516040015190506000610e4782876110d090919063ffffffff16565b905080610e80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611b0b565b50505b600101610dbe565b5050505050505050505050565b60008160040183511015610ed8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611deb565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b606081831115610f3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611b42565b8351821115610f7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611b79565b8282036040519080825280601f01601f191660200182016040528015610fa7576020820181803883390190505b509050610fc8610fb682611111565b84610fc087611111565b018351611117565b9392505050565b6040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b81516040516060918490602080820280840182019291018285101561105a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017d90611bb0565b828511156110745761106d858583611117565b8497508793505b6001820191506020810190508084019250829450818852846040528688600184038151811061109f57fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015250959695505050505050565b60006020835102602084018181018192505b80831015611108578251808614156110fc57600194508193505b506020830192506110e2565b50505092915050565b60200190565b6020811015611141576001816020036101000a0380198351168185511680821786525050506111d6565b8282141561114e576111d6565b828211156111885760208103905080820181840181515b82851015611180578451865260209586019590940193611165565b9052506111d6565b60208103905080820181840183515b818612156111d157825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09283019290910190611197565b855250505b505050565b604051806101800160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000801916815260200160608152602001600081525090565b80516104ce81611f8c565b600082601f8301126112f0578081fd5b81356113036112fe82611ef8565b611ed1565b8181529150602080830190840160005b838110156113405761132b876020843589010161134a565b83526020928301929190910190600101611313565b5050505092915050565b600082601f83011261135a578081fd5b81356113686112fe82611f19565b915080825283602082850101111561137f57600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126113a957600080fd5b81516113b76112fe82611f19565b91508082528360208285010111156113ce57600080fd5b6113df816020840160208601611f5c565b5092915050565b60006101808083850312156113f9578182fd5b61140281611ed1565b91505061140f83836112d5565b815261141e83602084016112d5565b602082015261143083604084016112d5565b604082015261144283606084016112d5565b60608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201526101008083015181830152506101208083015181830152506101408083015167ffffffffffffffff808211156114a457600080fd5b6114b086838701611398565b838501526101609250828501519150808211156114cc57600080fd5b506114d985828601611398565b82840152505092915050565b6000606082840312156114f6578081fd5b6115006060611ed1565b905081358152602082013561151481611f8c565b6020820152604082013567ffffffffffffffff81111561153357600080fd5b61153f8482850161134a565b60408301525092915050565b6000602080838503121561155d578182fd5b825167ffffffffffffffff811115611573578283fd5b80840185601f820112611584578384fd5b805191506115946112fe83611ef8565b82815283810190828501865b858110156115c9576115b78a8884518801016113e6565b845292860192908601906001016115a0565b509098975050505050505050565b600080604083850312156115ea57600080fd5b82359150602083013567ffffffffffffffff81111561160857600080fd5b6116148582860161134a565b9150509250929050565b60006020828403121561163057600080fd5b813567ffffffffffffffff81111561164757600080fd5b6116538482850161134a565b949350505050565b60006020828403121561166c578081fd5b813567ffffffffffffffff80821115611683578283fd5b81840160808187031215611695578384fd5b61169f6080611ed1565b925080356116ac81611f8c565b8352602081810135908401526040810135828111156116c9578485fd5b6116d58782840161134a565b60408501525060609081013590830152509392505050565b6000602082840312156116ff57600080fd5b815167ffffffffffffffff81111561171657600080fd5b611653848285016113e6565b6000806040838503121561173557600080fd5b825167ffffffffffffffff8082111561174d57600080fd5b611759868387016113e6565b9350602085015191508082111561176f57600080fd5b50611614858286016113e6565b60006020828403121561178e57600080fd5b813567ffffffffffffffff8111156117a557600080fd5b611653848285016114e5565b600080600080600060a086880312156117c8578081fd5b853567ffffffffffffffff808211156117df578283fd5b6117eb89838a016114e5565b965060209150818801356117fe81611f8c565b9550604088013581811115611811578384fd5b61181d8a828b0161134a565b955050606088013581811115611831578384fd5b8089018a601f820112611842578485fd5b803591506118526112fe83611ef8565b82815284810190828601868502840187018e101561186e578788fd5b8793505b84841015611890578035835260019390930192918601918601611872565b50965050505060808801359150808211156118a9578283fd5b506118b6888289016112e0565b9150509295509295909350565b73ffffffffffffffffffffffffffffffffffffffff169052565b600081518084526118f5816020860160208601611f5c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600060208083018184528085518083526040860191506040848202870101925083870160005b82811015611aa0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845281516101806119de8783516118c3565b878201516119ee898901826118c3565b506040820151611a0160408901826118c3565b506060820151611a1460608901826118c3565b506080820151608088015260a082015160a088015260c082015160c088015260e082015160e08801526101008083015181890152506101208083015181890152506101408083015182828a0152611a6d838a01826118dd565b915050610160915081830151888203838a0152611a8a82826118dd565b985050509487019450509085019060010161199f565b5092979650505050505050565b90815260200190565b93845260ff9290921660208401526040830152606082015260800190565b60208082526012908201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604082015260600190565b6020808252601a908201527f494e56414c49445f415050524f56414c5f5349474e4154555245000000000000604082015260600190565b6020808252601a908201527f46524f4d5f4c4553535f5448414e5f544f5f5245515549524544000000000000604082015260600190565b6020808252601c908201527f544f5f4c4553535f5448414e5f4c454e4754485f524551554952454400000000604082015260600190565b60208082526017908201527f494e56414c49445f465245455f4d454d4f52595f505452000000000000000000604082015260600190565b60208082526010908201527f415050524f56414c5f4558504952454400000000000000000000000000000000604082015260600190565b60208082526026908201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560408201527f5155495245440000000000000000000000000000000000000000000000000000606082015260800190565b60208082526015908201527f5349474e41545552455f554e535550504f525445440000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f4f524947494e000000000000000000000000000000000000604082015260600190565b60208082526021908201527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560408201527f4400000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f5349474e41545552455f494c4c4547414c000000000000000000000000000000604082015260600190565b6020808252601e908201527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000604082015260600190565b60208082526011908201527f5349474e41545552455f494e56414c4944000000000000000000000000000000604082015260600190565b60208082526025908201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160408201527f5549524544000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f4c454e4754485f305f5245515549524544000000000000000000000000000000604082015260600190565b600085825273ffffffffffffffffffffffffffffffffffffffff8516602083015260806040830152611eb460808301856118dd565b8281036060840152611ec681856118dd565b979650505050505050565b60405181810167ffffffffffffffff81118282101715611ef057600080fd5b604052919050565b600067ffffffffffffffff821115611f0f57600080fd5b5060209081020190565b600067ffffffffffffffff821115611f3057600080fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015611f77578181015183820152602001611f5f565b83811115611f86576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114611fae57600080fd5b5056fea265627a7a72305820bcdb4aab3e1a04ea5cd6c138911116ceac3fac88de1995c4d3f24fdd3f420fb66c6578706572696d656e74616cf50037" + "object": "0x60806040526002805460ff191690553480156200001b57600080fd5b5060405162002094380380620020948339810160408190526200003e9162000201565b81818181600080309050620000cb6040518060400160405280601781526020017f30782050726f746f636f6c20436f6f7264696e61746f720000000000000000008152506040518060400160405280600581526020017f332e302e300000000000000000000000000000000000000000000000000000008152508584620001aa60201b62001daf1760201c565b6000908155925050506001600160a01b03821615620000eb5781620000ed565b305b9050620001726040518060400160405280600b81526020017f30782050726f746f636f6c0000000000000000000000000000000000000000008152506040518060400160405280600581526020017f332e302e300000000000000000000000000000000000000000000000000000008152508584620001aa60201b62001daf1760201c565b6001555050600280546001600160a01b03909316620100000262010000600160b01b031990931692909217909155506200023b915050565b8351602094850120835193850193909320604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815295860194909452928401929092526060830152608082015260a0902090565b6000806040838503121562000214578182fd5b82516001600160a01b03811681146200022b578283fd5b6020939093015192949293505050565b611e49806200024b6000396000f3fe6080604052600436106100b15760003560e01c8063da4fe07411610069578063ee55b9681161004e578063ee55b9681461018a578063fb6961cc146101b7578063fdd059a5146101cc576100b1565b8063da4fe07414610162578063e1c7157814610175576100b1565b806389fab5b71161009a57806389fab5b714610109578063b2562b7a1461012b578063c26cfecd14610140576100b1565b80630f7d8e39146100b357806352813679146100e9575b005b3480156100bf57600080fd5b506100d36100ce3660046116c2565b6101ec565b6040516100e09190611a15565b60405180910390f35b3480156100f557600080fd5b506100b1610104366004611889565b610455565b34801561011557600080fd5b5061011e610482565b6040516100e09190611c41565b34801561013757600080fd5b5061011e6104bb565b34801561014c57600080fd5b506101556104f4565b6040516100e09190611ba2565b6100b1610170366004611889565b6104fa565b34801561018157600080fd5b506101556105e8565b34801561019657600080fd5b506101aa6101a5366004611707565b61060c565b6040516100e09190611a36565b3480156101c357600080fd5b50610155610ac0565b3480156101d857600080fd5b506101556101e7366004611775565b610ac6565b80516000908061020a5761020a61020560008686610ad9565b610b7e565b60008360018551038151811061021c57fe5b016020015160f81c90506008811061023d5761023d61020560018787610ad9565b60008160ff16600881111561024e57fe5b9050600081600881111561025e57fe5b14156102785761027361020560028888610ad9565b61043c565b600181600881111561028657fe5b141561029b5761027361020560038888610ad9565b60028160088111156102a957fe5b141561038557826042146102c6576102c661020560008888610ad9565b6000856000815181106102d557fe5b016020015160f81c905060006102f287600163ffffffff610b8616565b9050600061030788602163ffffffff610b8616565b90506001898484846040516000815260200160405260405161032c9493929190611bcf565b6020604051602081039080840390855afa15801561034e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00151975061044f9650505050505050565b600381600881111561039357fe5b141561043c57826042146103b0576103b061020560008888610ad9565b6000856000815181106103bf57fe5b016020015160f81c905060006103dc87600163ffffffff610b8616565b905060006103f188602163ffffffff610b8616565b905060018960405160200161040691906119e4565b604051602081830303815290604052805190602001208484846040516000815260200160405260405161032c9493929190611bcf565b61044b61020560018888610ad9565b5050505b92915050565b6060610464856080015161060c565b80519091501561047b5761047b8582868686610bb0565b5050505050565b6040518060400160405280601781526020017f30782050726f746f636f6c20436f6f7264696e61746f7200000000000000000081525081565b6040518060400160405280600581526020017f332e302e3000000000000000000000000000000000000000000000000000000081525081565b60015481565b61050684848484610455565b6002546040517f2280c9100000000000000000000000000000000000000000000000000000000081526201000090910473ffffffffffffffffffffffffffffffffffffffff1690632280c9109034906105659088908790600401611c54565b6000604051808303818588803b15801561057e57600080fd5b505af1158015610592573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526105d99190810190611742565b506105e2610d5d565b50505050565b7fa6511c04ca44625d50986f8c36bedc09366207a17b96e347094053a9f850716881565b60606000610620838263ffffffff610d7316565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167f9b44d5560000000000000000000000000000000000000000000000000000000014806106b357507fffffffff0000000000000000000000000000000000000000000000000000000081167fe14b58c400000000000000000000000000000000000000000000000000000000145b1561073c576106c06112e6565b83516106d690859060049063ffffffff610dbf16565b8060200190516106e991908101906117ff565b604080516001808252818301909252919250816020015b6107086112e6565b815260200190600190039081610700579050509250808360008151811061072b57fe5b602002602001018190525050610aba565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f9694a4020000000000000000000000000000000000000000000000000000000014806107cd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f8ea8dfe400000000000000000000000000000000000000000000000000000000145b8061081957507fffffffff0000000000000000000000000000000000000000000000000000000081167fbeee2e1400000000000000000000000000000000000000000000000000000000145b8061086557507fffffffff0000000000000000000000000000000000000000000000000000000081167f78d29ac100000000000000000000000000000000000000000000000000000000145b806108b157507fffffffff0000000000000000000000000000000000000000000000000000000081167f8bc8efb300000000000000000000000000000000000000000000000000000000145b806108fd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f369da09900000000000000000000000000000000000000000000000000000000145b8061094957507fffffffff0000000000000000000000000000000000000000000000000000000081167fa6c3bf3300000000000000000000000000000000000000000000000000000000145b1561097e57825161096490849060049063ffffffff610dbf16565b8060200190516109779190810190611636565b9150610aba565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f88ec79fb000000000000000000000000000000000000000000000000000000001480610a0f57507fffffffff0000000000000000000000000000000000000000000000000000000081167fb718e29200000000000000000000000000000000000000000000000000000000145b15610aba57610a1c6112e6565b610a246112e6565b8451610a3a90869060049063ffffffff610dbf16565b806020019051610a4d9190810190611832565b60408051600280825260608201909252929450909250816020015b610a706112e6565b815260200190600190039081610a685790505093508184600081518110610a9357fe5b60200260200101819052508084600181518110610aac57fe5b602002602001018190525050505b50919050565b60005481565b600061044f610ad483610e46565b610e99565b606063779c522360e01b848484604051602401610af893929190611c0f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b805160208201fd5b60008160200183511015610ba757610ba76102056005855185602001610ea7565b50016020015190565b3273ffffffffffffffffffffffffffffffffffffffff841614610bd957610bd961020584610ec6565b6000610be786600154610f65565b60408051600080825260208201909252845192935091905b818114610c9057610c0e6113ad565b60405180606001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018881525090506000610c4c82610ac6565b90506000610c6d82898681518110610c6057fe5b60200260200101516101ec565b9050610c7f868263ffffffff610f7916565b95505060019092019150610bff9050565b50610ca1823263ffffffff610f7916565b875190925060005b818114610d5157600073ffffffffffffffffffffffffffffffffffffffff16898281518110610cd457fe5b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff161415610d0157610d49565b6000898281518110610d0f57fe5b60200260200101516040015190506000610d32828761101b90919063ffffffff16565b905080610d4657610d466102058884611053565b50505b600101610ca9565b50505050505050505050565b610d656110f5565b610d7157610d71611103565b565b60008160040183511015610d9457610d946102056003855185600401610ea7565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b606081831115610dd857610dd861020560008585610ea7565b8351821115610df157610df16102056001848751610ea7565b8282036040519080825280601f01601f191660200182016040528015610e1e576020820181803883390190505b509050610e3f610e2d8261113d565b84610e378761113d565b018351611143565b9392505050565b604081810151825160209384015182519285019290922083517fa6511c04ca44625d50986f8c36bedc09366207a17b96e347094053a9f85071688152948501919091529183015260608201526080902090565b600061044f60005483611207565b6060632800659560e01b848484604051602401610af893929190611bed565b606063a458d7ff60e01b82604051602401610ee19190611a15565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b6000610e3f82610f7485611241565b611207565b815160405160609184906020808202808401820192910182851015610fa557610fa561020586856112c9565b82851115610fbf57610fb8858583611143565b8497508793505b60018201915060208101905080840192508294508188528460405286886001840381518110610fea57fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015250959695505050505050565b60006020835102602084018181018192505b8083101561044b5782518086141561104757600194508193505b5060208301925061102d565b606063d789b64060e01b8383604051602401611070929190611bab565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b600254610100900460ff1690565b3031801561113a57604051339082156108fc029083906000818181858888f19350505050158015611138573d6000803e3d6000fd5b505b50565b60200190565b602081101561116d576001816020036101000a038019835116818551168082178652505050611202565b8282141561117a57611202565b828211156111b45760208103905080820181840181515b828510156111ac578451865260209586019590940193611191565b905250611202565b60208103905080820181840183515b818612156111fd57825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe092830192909101906111c3565b855250505b505050565b6040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b608081810151825160208085015160408087015160609788015186519685019690962082517fec69816980a3a3ca4554410e60253953e9ff375ba4536a98adfa15cc71541508815294850195909552908301919091529481019490945273ffffffffffffffffffffffffffffffffffffffff9091169183019190915260a082015260c0902090565b6060635fc8372260e01b8383604051602401611070929190611cca565b604051806101c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6040805160608082018352600080835260208301529181019190915290565b803561044f81611d8d565b805161044f81611d8d565b600082601f8301126113f2578081fd5b813561140561140082611cff565b611cd8565b8181529150602080830190840160005b838110156114425761142d876020843589010161144c565b83526020928301929190910190600101611415565b5050505092915050565b600082601f83011261145c578081fd5b813561146a61140082611d1f565b915080825283602082850101111561148157600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126114aa578081fd5b81516114b861140082611d1f565b91508082528360208285010111156114cf57600080fd5b6114e0816020840160208601611d61565b5092915050565b60006101c08083850312156114fa578182fd5b61150381611cd8565b91505061151083836113d7565b815261151f83602084016113d7565b602082015261153183604084016113d7565b604082015261154383606084016113d7565b60608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201526101008083015181830152506101208083015181830152506101408083015167ffffffffffffffff808211156115a557600080fd5b6115b18683870161149a565b838501526101609250828501519150808211156115cd57600080fd5b6115d98683870161149a565b838501526101809250828501519150808211156115f557600080fd5b6116018683870161149a565b838501526101a092508285015191508082111561161d57600080fd5b5061162a8582860161149a565b82840152505092915050565b60006020808385031215611648578182fd5b825167ffffffffffffffff81111561165e578283fd5b80840185601f82011261166f578384fd5b8051915061167f61140083611cff565b82815283810190828501865b858110156116b4576116a28a8884518801016114e7565b8452928601929086019060010161168b565b509098975050505050505050565b600080604083850312156116d4578081fd5b82359150602083013567ffffffffffffffff8111156116f1578182fd5b6116fd8582860161144c565b9150509250929050565b600060208284031215611718578081fd5b813567ffffffffffffffff81111561172e578182fd5b61173a8482850161144c565b949350505050565b600060208284031215611753578081fd5b815167ffffffffffffffff811115611769578182fd5b61173a8482850161149a565b600060208284031215611786578081fd5b813567ffffffffffffffff8082111561179d578283fd5b818401606081870312156117af578384fd5b6117b96060611cd8565b925080356117c681611d8d565b8352602081810135908401526040810135828111156117e3578485fd5b6117ef8782840161144c565b6040850152509195945050505050565b600060208284031215611810578081fd5b815167ffffffffffffffff811115611826578182fd5b61173a848285016114e7565b60008060408385031215611844578182fd5b825167ffffffffffffffff8082111561185b578384fd5b611867868387016114e7565b9350602085015191508082111561187c578283fd5b506116fd858286016114e7565b6000806000806080858703121561189e578182fd5b843567ffffffffffffffff808211156118b5578384fd5b81870160a0818a0312156118c7578485fd5b6118d160a0611cd8565b92508035835260208101356020840152604081013560408401526118f889606083016113cc565b606084015260808101358281111561190e578586fd5b61191a8a82840161144c565b6080850152505081955061193188602089016113cc565b94506040870135915080821115611946578384fd5b6119528883890161144c565b93506060870135915080821115611967578283fd5b50611974878288016113e2565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff169052565b600081518084526119b2816020860160208601611d61565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015611b95577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845281516101c0611a9a878351611980565b87820151611aaa89890182611980565b506040820151611abd6040890182611980565b506060820151611ad06060890182611980565b506080820151608088015260a082015160a088015260c082015160c088015260e082015160e08801526101008083015181890152506101208083015181890152506101408083015182828a0152611b29838a018261199a565b915050610160915081830151888203838a0152611b46828261199a565b9250505061018080830151888303828a0152611b62838261199a565b9150506101a0915081830151888203838a0152611b7f828261199a565b9850505094870194505090850190600101611a5b565b5092979650505050505050565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b93845260ff9290921660208401526040830152606082015260800190565b6060810160088510611bfb57fe5b938152602081019290925260409091015290565b600060048510611c1b57fe5b84825283602083015260606040830152611c38606083018461199a565b95945050505050565b600060208252610e3f602083018461199a565b60006040825283516040830152602084015160608301526040840151608083015273ffffffffffffffffffffffffffffffffffffffff60608501511660a0830152608084015160a060c0840152611cae60e084018261199a565b8381036020850152611cc0818661199a565b9695505050505050565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715611cf757600080fd5b604052919050565b600067ffffffffffffffff821115611d15578081fd5b5060209081020190565b600067ffffffffffffffff821115611d35578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015611d7c578181015183820152602001611d64565b838111156105e25750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461113a57600080fd5b8351602094850120835193850193909320604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815295860194909452928401929092526060830152608082015260a090209056fea365627a7a72315820efc81773b7912bf9e2c93c985afa2b6feee69452023986811fc84107b08ecc776c6578706572696d656e74616cf564736f6c634300050d0040" + }, + "deployedBytecode": { + "object": "0x6080604052600436106100b15760003560e01c8063da4fe07411610069578063ee55b9681161004e578063ee55b9681461018a578063fb6961cc146101b7578063fdd059a5146101cc576100b1565b8063da4fe07414610162578063e1c7157814610175576100b1565b806389fab5b71161009a57806389fab5b714610109578063b2562b7a1461012b578063c26cfecd14610140576100b1565b80630f7d8e39146100b357806352813679146100e9575b005b3480156100bf57600080fd5b506100d36100ce3660046116c2565b6101ec565b6040516100e09190611a15565b60405180910390f35b3480156100f557600080fd5b506100b1610104366004611889565b610455565b34801561011557600080fd5b5061011e610482565b6040516100e09190611c41565b34801561013757600080fd5b5061011e6104bb565b34801561014c57600080fd5b506101556104f4565b6040516100e09190611ba2565b6100b1610170366004611889565b6104fa565b34801561018157600080fd5b506101556105e8565b34801561019657600080fd5b506101aa6101a5366004611707565b61060c565b6040516100e09190611a36565b3480156101c357600080fd5b50610155610ac0565b3480156101d857600080fd5b506101556101e7366004611775565b610ac6565b80516000908061020a5761020a61020560008686610ad9565b610b7e565b60008360018551038151811061021c57fe5b016020015160f81c90506008811061023d5761023d61020560018787610ad9565b60008160ff16600881111561024e57fe5b9050600081600881111561025e57fe5b14156102785761027361020560028888610ad9565b61043c565b600181600881111561028657fe5b141561029b5761027361020560038888610ad9565b60028160088111156102a957fe5b141561038557826042146102c6576102c661020560008888610ad9565b6000856000815181106102d557fe5b016020015160f81c905060006102f287600163ffffffff610b8616565b9050600061030788602163ffffffff610b8616565b90506001898484846040516000815260200160405260405161032c9493929190611bcf565b6020604051602081039080840390855afa15801561034e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00151975061044f9650505050505050565b600381600881111561039357fe5b141561043c57826042146103b0576103b061020560008888610ad9565b6000856000815181106103bf57fe5b016020015160f81c905060006103dc87600163ffffffff610b8616565b905060006103f188602163ffffffff610b8616565b905060018960405160200161040691906119e4565b604051602081830303815290604052805190602001208484846040516000815260200160405260405161032c9493929190611bcf565b61044b61020560018888610ad9565b5050505b92915050565b6060610464856080015161060c565b80519091501561047b5761047b8582868686610bb0565b5050505050565b6040518060400160405280601781526020017f30782050726f746f636f6c20436f6f7264696e61746f7200000000000000000081525081565b6040518060400160405280600581526020017f332e302e3000000000000000000000000000000000000000000000000000000081525081565b60015481565b61050684848484610455565b6002546040517f2280c9100000000000000000000000000000000000000000000000000000000081526201000090910473ffffffffffffffffffffffffffffffffffffffff1690632280c9109034906105659088908790600401611c54565b6000604051808303818588803b15801561057e57600080fd5b505af1158015610592573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526105d99190810190611742565b506105e2610d5d565b50505050565b7fa6511c04ca44625d50986f8c36bedc09366207a17b96e347094053a9f850716881565b60606000610620838263ffffffff610d7316565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167f9b44d5560000000000000000000000000000000000000000000000000000000014806106b357507fffffffff0000000000000000000000000000000000000000000000000000000081167fe14b58c400000000000000000000000000000000000000000000000000000000145b1561073c576106c06112e6565b83516106d690859060049063ffffffff610dbf16565b8060200190516106e991908101906117ff565b604080516001808252818301909252919250816020015b6107086112e6565b815260200190600190039081610700579050509250808360008151811061072b57fe5b602002602001018190525050610aba565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f9694a4020000000000000000000000000000000000000000000000000000000014806107cd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f8ea8dfe400000000000000000000000000000000000000000000000000000000145b8061081957507fffffffff0000000000000000000000000000000000000000000000000000000081167fbeee2e1400000000000000000000000000000000000000000000000000000000145b8061086557507fffffffff0000000000000000000000000000000000000000000000000000000081167f78d29ac100000000000000000000000000000000000000000000000000000000145b806108b157507fffffffff0000000000000000000000000000000000000000000000000000000081167f8bc8efb300000000000000000000000000000000000000000000000000000000145b806108fd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f369da09900000000000000000000000000000000000000000000000000000000145b8061094957507fffffffff0000000000000000000000000000000000000000000000000000000081167fa6c3bf3300000000000000000000000000000000000000000000000000000000145b1561097e57825161096490849060049063ffffffff610dbf16565b8060200190516109779190810190611636565b9150610aba565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f88ec79fb000000000000000000000000000000000000000000000000000000001480610a0f57507fffffffff0000000000000000000000000000000000000000000000000000000081167fb718e29200000000000000000000000000000000000000000000000000000000145b15610aba57610a1c6112e6565b610a246112e6565b8451610a3a90869060049063ffffffff610dbf16565b806020019051610a4d9190810190611832565b60408051600280825260608201909252929450909250816020015b610a706112e6565b815260200190600190039081610a685790505093508184600081518110610a9357fe5b60200260200101819052508084600181518110610aac57fe5b602002602001018190525050505b50919050565b60005481565b600061044f610ad483610e46565b610e99565b606063779c522360e01b848484604051602401610af893929190611c0f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b805160208201fd5b60008160200183511015610ba757610ba76102056005855185602001610ea7565b50016020015190565b3273ffffffffffffffffffffffffffffffffffffffff841614610bd957610bd961020584610ec6565b6000610be786600154610f65565b60408051600080825260208201909252845192935091905b818114610c9057610c0e6113ad565b60405180606001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018881525090506000610c4c82610ac6565b90506000610c6d82898681518110610c6057fe5b60200260200101516101ec565b9050610c7f868263ffffffff610f7916565b95505060019092019150610bff9050565b50610ca1823263ffffffff610f7916565b875190925060005b818114610d5157600073ffffffffffffffffffffffffffffffffffffffff16898281518110610cd457fe5b60200260200101516060015173ffffffffffffffffffffffffffffffffffffffff161415610d0157610d49565b6000898281518110610d0f57fe5b60200260200101516040015190506000610d32828761101b90919063ffffffff16565b905080610d4657610d466102058884611053565b50505b600101610ca9565b50505050505050505050565b610d656110f5565b610d7157610d71611103565b565b60008160040183511015610d9457610d946102056003855185600401610ea7565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b606081831115610dd857610dd861020560008585610ea7565b8351821115610df157610df16102056001848751610ea7565b8282036040519080825280601f01601f191660200182016040528015610e1e576020820181803883390190505b509050610e3f610e2d8261113d565b84610e378761113d565b018351611143565b9392505050565b604081810151825160209384015182519285019290922083517fa6511c04ca44625d50986f8c36bedc09366207a17b96e347094053a9f85071688152948501919091529183015260608201526080902090565b600061044f60005483611207565b6060632800659560e01b848484604051602401610af893929190611bed565b606063a458d7ff60e01b82604051602401610ee19190611a15565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b6000610e3f82610f7485611241565b611207565b815160405160609184906020808202808401820192910182851015610fa557610fa561020586856112c9565b82851115610fbf57610fb8858583611143565b8497508793505b60018201915060208101905080840192508294508188528460405286886001840381518110610fea57fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015250959695505050505050565b60006020835102602084018181018192505b8083101561044b5782518086141561104757600194508193505b5060208301925061102d565b606063d789b64060e01b8383604051602401611070929190611bab565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b600254610100900460ff1690565b3031801561113a57604051339082156108fc029083906000818181858888f19350505050158015611138573d6000803e3d6000fd5b505b50565b60200190565b602081101561116d576001816020036101000a038019835116818551168082178652505050611202565b8282141561117a57611202565b828211156111b45760208103905080820181840181515b828510156111ac578451865260209586019590940193611191565b905250611202565b60208103905080820181840183515b818612156111fd57825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe092830192909101906111c3565b855250505b505050565b6040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b608081810151825160208085015160408087015160609788015186519685019690962082517fec69816980a3a3ca4554410e60253953e9ff375ba4536a98adfa15cc71541508815294850195909552908301919091529481019490945273ffffffffffffffffffffffffffffffffffffffff9091169183019190915260a082015260c0902090565b6060635fc8372260e01b8383604051602401611070929190611cca565b604051806101c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6040805160608082018352600080835260208301529181019190915290565b803561044f81611d8d565b805161044f81611d8d565b600082601f8301126113f2578081fd5b813561140561140082611cff565b611cd8565b8181529150602080830190840160005b838110156114425761142d876020843589010161144c565b83526020928301929190910190600101611415565b5050505092915050565b600082601f83011261145c578081fd5b813561146a61140082611d1f565b915080825283602082850101111561148157600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126114aa578081fd5b81516114b861140082611d1f565b91508082528360208285010111156114cf57600080fd5b6114e0816020840160208601611d61565b5092915050565b60006101c08083850312156114fa578182fd5b61150381611cd8565b91505061151083836113d7565b815261151f83602084016113d7565b602082015261153183604084016113d7565b604082015261154383606084016113d7565b60608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201526101008083015181830152506101208083015181830152506101408083015167ffffffffffffffff808211156115a557600080fd5b6115b18683870161149a565b838501526101609250828501519150808211156115cd57600080fd5b6115d98683870161149a565b838501526101809250828501519150808211156115f557600080fd5b6116018683870161149a565b838501526101a092508285015191508082111561161d57600080fd5b5061162a8582860161149a565b82840152505092915050565b60006020808385031215611648578182fd5b825167ffffffffffffffff81111561165e578283fd5b80840185601f82011261166f578384fd5b8051915061167f61140083611cff565b82815283810190828501865b858110156116b4576116a28a8884518801016114e7565b8452928601929086019060010161168b565b509098975050505050505050565b600080604083850312156116d4578081fd5b82359150602083013567ffffffffffffffff8111156116f1578182fd5b6116fd8582860161144c565b9150509250929050565b600060208284031215611718578081fd5b813567ffffffffffffffff81111561172e578182fd5b61173a8482850161144c565b949350505050565b600060208284031215611753578081fd5b815167ffffffffffffffff811115611769578182fd5b61173a8482850161149a565b600060208284031215611786578081fd5b813567ffffffffffffffff8082111561179d578283fd5b818401606081870312156117af578384fd5b6117b96060611cd8565b925080356117c681611d8d565b8352602081810135908401526040810135828111156117e3578485fd5b6117ef8782840161144c565b6040850152509195945050505050565b600060208284031215611810578081fd5b815167ffffffffffffffff811115611826578182fd5b61173a848285016114e7565b60008060408385031215611844578182fd5b825167ffffffffffffffff8082111561185b578384fd5b611867868387016114e7565b9350602085015191508082111561187c578283fd5b506116fd858286016114e7565b6000806000806080858703121561189e578182fd5b843567ffffffffffffffff808211156118b5578384fd5b81870160a0818a0312156118c7578485fd5b6118d160a0611cd8565b92508035835260208101356020840152604081013560408401526118f889606083016113cc565b606084015260808101358281111561190e578586fd5b61191a8a82840161144c565b6080850152505081955061193188602089016113cc565b94506040870135915080821115611946578384fd5b6119528883890161144c565b93506060870135915080821115611967578283fd5b50611974878288016113e2565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff169052565b600081518084526119b2816020860160208601611d61565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015611b95577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845281516101c0611a9a878351611980565b87820151611aaa89890182611980565b506040820151611abd6040890182611980565b506060820151611ad06060890182611980565b506080820151608088015260a082015160a088015260c082015160c088015260e082015160e08801526101008083015181890152506101208083015181890152506101408083015182828a0152611b29838a018261199a565b915050610160915081830151888203838a0152611b46828261199a565b9250505061018080830151888303828a0152611b62838261199a565b9150506101a0915081830151888203838a0152611b7f828261199a565b9850505094870194505090850190600101611a5b565b5092979650505050505050565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b93845260ff9290921660208401526040830152606082015260800190565b6060810160088510611bfb57fe5b938152602081019290925260409091015290565b600060048510611c1b57fe5b84825283602083015260606040830152611c38606083018461199a565b95945050505050565b600060208252610e3f602083018461199a565b60006040825283516040830152602084015160608301526040840151608083015273ffffffffffffffffffffffffffffffffffffffff60608501511660a0830152608084015160a060c0840152611cae60e084018261199a565b8381036020850152611cc0818661199a565b9695505050505050565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715611cf757600080fd5b604052919050565b600067ffffffffffffffff821115611d15578081fd5b5060209081020190565b600067ffffffffffffffff821115611d35578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015611d7c578181015183820152602001611d64565b838111156105e25750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461113a57600080fd5b8351602094850120835193850193909320604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815295860194909452928401929092526060830152608082015260a090209056fea365627a7a72315820efc81773b7912bf9e2c93c985afa2b6feee69452023986811fc84107b08ecc776c6578706572696d656e74616cf564736f6c634300050d0040" } } }, - "networks": {} + "compiler": { + "name": "solc", + "version": "soljson-v0.5.13+commit.5b0b510c.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/CoordinatorRegistry.json b/packages/contract-artifacts/artifacts/CoordinatorRegistry.json index a1ce8b525a..e7c1f647a2 100644 --- a/packages/contract-artifacts/artifacts/CoordinatorRegistry.json +++ b/packages/contract-artifacts/artifacts/CoordinatorRegistry.json @@ -3,52 +3,80 @@ "contractName": "CoordinatorRegistry", "compilerOutput": { "abi": [ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "coordinatorOperator", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "coordinatorEndpoint", "type": "string" } + ], + "name": "CoordinatorEndpointSet", + "type": "event" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "coordinatorOperator", "type": "address" }], + "name": "getCoordinatorEndpoint", + "outputs": [{ "internalType": "string", "name": "coordinatorEndpoint", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, - "inputs": [{ "name": "coordinatorEndpoint", "type": "string" }], + "inputs": [{ "internalType": "string", "name": "coordinatorEndpoint", "type": "string" }], "name": "setCoordinatorEndpoint", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "coordinatorOperator", "type": "address" }], - "name": "getCoordinatorEndpoint", - "outputs": [{ "name": "coordinatorEndpoint", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "coordinatorOperator", "type": "address" }, - { "indexed": false, "name": "coordinatorEndpoint", "type": "string" } - ], - "name": "CoordinatorEndpointSet", - "type": "event" } ], "devdoc": { "methods": { "getCoordinatorEndpoint(address)": { "details": "Gets the endpoint for a Coordinator.", - "params": { "coordinatorOperator": "operator of the Coordinator endpoint." } + "params": { "coordinatorOperator": "Operator of the Coordinator endpoint." }, + "return": "coordinatorEndpoint Endpoint of the Coordinator as a string." }, "setCoordinatorEndpoint(string)": { "details": "Called by a Coordinator operator to set the endpoint of their Coordinator.", - "params": { "coordinatorEndpoint": "endpoint of the Coordinator." } + "params": { "coordinatorEndpoint": "Endpoint of the Coordinator as a string." } } } }, "evm": { "bytecode": { - "object": "0x608060405234801561001057600080fd5b506104b5806100206000396000f3fe608060405234801561001057600080fd5b5060043610610052577c010000000000000000000000000000000000000000000000000000000060003504635b2388be81146100575780636c90fedb1461006c575b600080fd5b61006a6100653660046102ff565b610095565b005b61007f61007a3660046102d9565b6100f0565b60405161008c91906103d8565b60405180910390f35b3360008181526020819052604090206100af9084846101c4565b507fd060052768902f3eecb84b8eae9d3a2608a1a9e60811a33968b46b8d552f266e8184846040516100e3939291906103ae565b60405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260409182902080548351601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b50505050509050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610223578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555610250565b82800160010185558215610250579182015b82811115610250578235825591602001919060010190610235565b5061025c929150610260565b5090565b61027a91905b8082111561025c5760008155600101610266565b90565b600061028982356103ed565b9392505050565b600080601f830184136102a257600080fd5b50813567ffffffffffffffff8111156102ba57600080fd5b6020830191508360018202830111156102d257600080fd5b9250929050565b6000602082840312156102eb57600080fd5b60006102f7848461027d565b949350505050565b6000806020838503121561031257600080fd5b823567ffffffffffffffff81111561032957600080fd5b61033585828601610290565b92509250509250929050565b61034a816103ed565b82525050565b6000828452602084019350610366838584610417565b61036f83610453565b9093019392505050565b6000610384826103e9565b808452610398816020860160208601610423565b6103a181610453565b9093016020019392505050565b604081016103bc8286610341565b81810360208301526103cf818486610350565b95945050505050565b602080825281016102898184610379565b5190565b60006103f8826103fe565b92915050565b73ffffffffffffffffffffffffffffffffffffffff1690565b82818337506000910152565b60005b8381101561043e578181015183820152602001610426565b8381111561044d576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169056fea265627a7a72305820d8fc8bc6ec7167e671f9f87937212d93c49d5fbe171bbdfa06c846e5ac76151b6c6578706572696d656e74616cf50037" + "object": "0x608060405234801561001057600080fd5b506103e9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80635b2388be1461003b5780636c90fedb146100ad575b600080fd5b6100ab6004803603602081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b509092509050610155565b005b6100e0600480360360208110156100c357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610227565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011a578181015183820152602001610102565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b33600081815260208190526040902061016f9084846102fb565b507fd060052768902f3eecb84b8eae9d3a2608a1a9e60811a33968b46b8d552f266e818484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909201829003965090945050505050a1505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260409182902080548351601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156102ef5780601f106102c4576101008083540402835291602001916102ef565b820191906000526020600020905b8154815290600101906020018083116102d257829003601f168201915b50505050509050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061035a578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555610387565b82800160010185558215610387579182015b8281111561038757823582559160200191906001019061036c565b50610393929150610397565b5090565b6103b191905b80821115610393576000815560010161039d565b9056fea265627a7a723158201e5700868fc146b88ffb53f2aacd9f9684387be927a7cb4fdb2da136413c17f964736f6c634300050d0032" + }, + "deployedBytecode": { + "object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80635b2388be1461003b5780636c90fedb146100ad575b600080fd5b6100ab6004803603602081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b509092509050610155565b005b6100e0600480360360208110156100c357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610227565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011a578181015183820152602001610102565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b33600081815260208190526040902061016f9084846102fb565b507fd060052768902f3eecb84b8eae9d3a2608a1a9e60811a33968b46b8d552f266e818484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909201829003965090945050505050a1505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260409182902080548351601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156102ef5780601f106102c4576101008083540402835291602001916102ef565b820191906000526020600020905b8154815290600101906020018083116102d257829003601f168201915b50505050509050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061035a578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555610387565b82800160010185558215610387579182015b8281111561038757823582559160200191906001019061036c565b50610393929150610397565b5090565b6103b191905b80821115610393576000815560010161039d565b9056fea265627a7a723158201e5700868fc146b88ffb53f2aacd9f9684387be927a7cb4fdb2da136413c17f964736f6c634300050d0032" } } }, - "networks": {} + "compiler": { + "name": "solc", + "version": "soljson-v0.5.13+commit.5b0b510c.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/ZrxVault.json b/packages/contract-artifacts/artifacts/ZrxVault.json index 875d02e484..11f8109231 100644 --- a/packages/contract-artifacts/artifacts/ZrxVault.json +++ b/packages/contract-artifacts/artifacts/ZrxVault.json @@ -264,17 +264,13 @@ "methods": { "addAuthorizedAddress(address)": { "details": "Authorizes an address.", - "params": { - "target": "Address to authorize." - } + "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." - }, + "balanceOfZrxVault()": { "details": "Returns the entire balance of Zrx tokens in the vault." }, "constructor": { "details": "Constructor.", "params": { @@ -284,10 +280,7 @@ }, "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." - } + "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." @@ -298,9 +291,7 @@ }, "removeAuthorizedAddress(address)": { "details": "Removes authorizion of an address.", - "params": { - "target": "Address to remove authorization from." - } + "params": { "target": "Address to remove authorization from." } }, "removeAuthorizedAddressAtIndex(address,uint256)": { "details": "Removes authorizion of an address.", @@ -311,28 +302,19 @@ }, "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." - } + "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." - } + "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." - } + "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." - } + "params": { "amount": "of Zrx Tokens to withdraw.", "staker": "of Zrx Tokens." } } } }, diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index d1ab2d18a8..e8bae8f4b6 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -1,4 +1,5 @@ import { + CoordinatorContract, DevUtilsContract, ExchangeContract, ForwarderContract, @@ -22,7 +23,6 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { SupportedProvider } from 'ethereum-types'; import * as _ from 'lodash'; -import { CoordinatorWrapper } from './coordinator_wrapper'; import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema'; import { ContractWrappersConfig } from './types'; import { assert } from './utils/assert'; @@ -59,9 +59,9 @@ export class ContractWrappers { */ public devUtils: DevUtilsContract; /** - * An instance of the CoordinatorWrapper class containing methods for interacting with the Coordinator extension contract. + * An instance of the CoordinatorContract class containing methods for interacting with the Coordinator extension contract. */ - public coordinator: CoordinatorWrapper; + public coordinator: CoordinatorContract; private readonly _web3Wrapper: Web3Wrapper; /** @@ -100,13 +100,7 @@ export class ContractWrappers { this.forwarder = new ForwarderContract(contractAddresses.forwarder, this.getProvider()); this.orderValidator = new OrderValidatorContract(contractAddresses.orderValidator, this.getProvider()); this.devUtils = new DevUtilsContract(contractAddresses.devUtils, this.getProvider()); - this.coordinator = new CoordinatorWrapper( - this.getProvider(), - config.chainId, - contractAddresses.coordinator, - contractAddresses.exchange, - contractAddresses.coordinatorRegistry, - ); + this.coordinator = new CoordinatorContract(contractAddresses.coordinator, this.getProvider()); this.contractAddresses = contractAddresses; } /** diff --git a/packages/contract-wrappers/src/coordinator_wrapper.ts b/packages/contract-wrappers/src/coordinator_wrapper.ts index 75708f87ab..184765c37d 100644 --- a/packages/contract-wrappers/src/coordinator_wrapper.ts +++ b/packages/contract-wrappers/src/coordinator_wrapper.ts @@ -1,787 +1,787 @@ -import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses'; -import { Coordinator } from '@0x/contract-artifacts'; -import { schemas } from '@0x/json-schemas'; -import { generatePseudoRandomSalt, signatureUtils } from '@0x/order-utils'; -import { Order, SignedOrder, SignedZeroExTransaction, ZeroExTransaction } from '@0x/types'; -import { BigNumber, fetchAsync } from '@0x/utils'; -import { Web3Wrapper } from '@0x/web3-wrapper'; -import { ContractAbi, SupportedProvider } from 'ethereum-types'; -import * as HttpStatus from 'http-status-codes'; -import { flatten } from 'lodash'; +// import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses'; +// import { Coordinator } from '@0x/contract-artifacts'; +// import { schemas } from '@0x/json-schemas'; +// import { generatePseudoRandomSalt, signatureUtils } from '@0x/order-utils'; +// import { Order, SignedOrder, SignedZeroExTransaction, ZeroExTransaction } from '@0x/types'; +// import { BigNumber, fetchAsync } from '@0x/utils'; +// import { Web3Wrapper } from '@0x/web3-wrapper'; +// import { ContractAbi, SupportedProvider } from 'ethereum-types'; +// import * as HttpStatus from 'http-status-codes'; +// import { flatten } from 'lodash'; -import { CoordinatorContract, CoordinatorRegistryContract, ExchangeContract } from '@0x/abi-gen-wrappers'; +// import { CoordinatorContract, CoordinatorRegistryContract, ExchangeContract } from '@0x/abi-gen-wrappers'; -import { orderTxOptsSchema } from './schemas/order_tx_opts_schema'; -import { txOptsSchema } from './schemas/tx_opts_schema'; -import { CoordinatorTransaction, OrderTransactionOpts } from './types'; -import { assert } from './utils/assert'; -import { - CoordinatorServerApprovalRawResponse, - CoordinatorServerApprovalResponse, - CoordinatorServerCancellationResponse, - CoordinatorServerError, - CoordinatorServerErrorMsg, - CoordinatorServerResponse, -} from './utils/coordinator_server_types'; -import { decorators } from './utils/decorators'; +// import { orderTxOptsSchema } from './schemas/order_tx_opts_schema'; +// import { txOptsSchema } from './schemas/tx_opts_schema'; +// import { CoordinatorTransaction, OrderTransactionOpts } from './types'; +// import { assert } from './utils/assert'; +// import { +// CoordinatorServerApprovalRawResponse, +// CoordinatorServerApprovalResponse, +// CoordinatorServerCancellationResponse, +// CoordinatorServerError, +// CoordinatorServerErrorMsg, +// CoordinatorServerResponse, +// } from './utils/coordinator_server_types'; +// import { decorators } from './utils/decorators'; -/** - * This class includes all the functionality related to filling or cancelling orders through - * the 0x V2 Coordinator extension contract. - */ -export class CoordinatorWrapper { - public abi: ContractAbi = Coordinator.compilerOutput.abi; - public chainId: number; - public address: string; - public exchangeAddress: string; - public registryAddress: string; - private readonly _web3Wrapper: Web3Wrapper; - private readonly _contractInstance: CoordinatorContract; - private readonly _registryInstance: CoordinatorRegistryContract; - private readonly _exchangeInstance: ExchangeContract; - private readonly _feeRecipientToEndpoint: { [feeRecipient: string]: string } = {}; +// /** +// * This class includes all the functionality related to filling or cancelling orders through +// * the 0x V2 Coordinator extension contract. +// */ +// export class CoordinatorWrapper { +// public abi: ContractAbi = Coordinator.compilerOutput.abi; +// public chainId: number; +// public address: string; +// public exchangeAddress: string; +// public registryAddress: string; +// private readonly _web3Wrapper: Web3Wrapper; +// private readonly _contractInstance: CoordinatorContract; +// private readonly _registryInstance: CoordinatorRegistryContract; +// private readonly _exchangeInstance: ExchangeContract; +// private readonly _feeRecipientToEndpoint: { [feeRecipient: string]: string } = {}; - /** - * Instantiate CoordinatorWrapper - * @param web3Wrapper Web3Wrapper instance to use. - * @param chainId Desired chainId. - * @param address The address of the Coordinator contract. If undefined, will - * default to the known address corresponding to the chainId. - * @param exchangeAddress The address of the Exchange contract. If undefined, will - * default to the known address corresponding to the chainId. - * @param registryAddress The address of the CoordinatorRegistry contract. If undefined, will - * default to the known address corresponding to the chainId. - */ - constructor( - provider: SupportedProvider, - chainId: number, - address?: string, - exchangeAddress?: string, - registryAddress?: string, - ) { - this.chainId = chainId; - const contractAddresses = getContractAddressesForChainOrThrow(chainId); - this.address = address === undefined ? contractAddresses.coordinator : address; - this.exchangeAddress = exchangeAddress === undefined ? contractAddresses.coordinator : exchangeAddress; - this.registryAddress = registryAddress === undefined ? contractAddresses.coordinatorRegistry : registryAddress; - this._web3Wrapper = new Web3Wrapper(provider); +// /** +// * Instantiate CoordinatorWrapper +// * @param web3Wrapper Web3Wrapper instance to use. +// * @param chainId Desired chainId. +// * @param address The address of the Coordinator contract. If undefined, will +// * default to the known address corresponding to the chainId. +// * @param exchangeAddress The address of the Exchange contract. If undefined, will +// * default to the known address corresponding to the chainId. +// * @param registryAddress The address of the CoordinatorRegistry contract. If undefined, will +// * default to the known address corresponding to the chainId. +// */ +// constructor( +// provider: SupportedProvider, +// chainId: number, +// address?: string, +// exchangeAddress?: string, +// registryAddress?: string, +// ) { +// this.chainId = chainId; +// const contractAddresses = getContractAddressesForChainOrThrow(chainId); +// this.address = address === undefined ? contractAddresses.coordinator : address; +// this.exchangeAddress = exchangeAddress === undefined ? contractAddresses.coordinator : exchangeAddress; +// this.registryAddress = registryAddress === undefined ? contractAddresses.coordinatorRegistry : registryAddress; +// this._web3Wrapper = new Web3Wrapper(provider); - this._contractInstance = new CoordinatorContract( - this.address, - this._web3Wrapper.getProvider(), - this._web3Wrapper.getContractDefaults(), - ); - this._registryInstance = new CoordinatorRegistryContract( - this.registryAddress, - this._web3Wrapper.getProvider(), - this._web3Wrapper.getContractDefaults(), - ); - this._exchangeInstance = new ExchangeContract( - this.exchangeAddress, - this._web3Wrapper.getProvider(), - this._web3Wrapper.getContractDefaults(), - ); - } +// this._contractInstance = new CoordinatorContract( +// this.address, +// this._web3Wrapper.getProvider(), +// this._web3Wrapper.getContractDefaults(), +// ); +// this._registryInstance = new CoordinatorRegistryContract( +// this.registryAddress, +// this._web3Wrapper.getProvider(), +// this._web3Wrapper.getContractDefaults(), +// ); +// this._exchangeInstance = new ExchangeContract( +// this.exchangeAddress, +// this._web3Wrapper.getProvider(), +// this._web3Wrapper.getContractDefaults(), +// ); +// } - /** - * Fills a signed order with an amount denominated in baseUnits of the taker asset. Under-the-hood, this - * method uses the `feeRecipientAddress` of the order to look up the coordinator server endpoint registered in the - * coordinator registry contract. It requests a signature from that coordinator server before - * submitting the order and signature as a 0x transaction to the coordinator extension contract. The coordinator extension - * contract validates signatures and then fills the order via the Exchange contract. - * @param signedOrder An object that conforms to the SignedOrder interface. - * @param takerAssetFillAmount The amount of the order (in taker asset baseUnits) that you wish to fill. - * @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async fillOrderAsync( - signedOrder: SignedOrder, - takerAssetFillAmount: BigNumber, - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); - assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * Fills a signed order with an amount denominated in baseUnits of the taker asset. Under-the-hood, this +// * method uses the `feeRecipientAddress` of the order to look up the coordinator server endpoint registered in the +// * coordinator registry contract. It requests a signature from that coordinator server before +// * submitting the order and signature as a 0x transaction to the coordinator extension contract. The coordinator extension +// * contract validates signatures and then fills the order via the Exchange contract. +// * @param signedOrder An object that conforms to the SignedOrder interface. +// * @param takerAssetFillAmount The amount of the order (in taker asset baseUnits) that you wish to fill. +// * @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async fillOrderAsync( +// signedOrder: SignedOrder, +// takerAssetFillAmount: BigNumber, +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); +// assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const data = this._exchangeInstance - .fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, [signedOrder], orderTransactionOpts); - return txHash; - } +// const data = this._exchangeInstance +// .fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, [signedOrder], orderTransactionOpts); +// return txHash; +// } - /** - * Attempts to fill a specific amount of an order. If the entire amount specified cannot be filled, - * the fill order is abandoned. - * @param signedOrder An object that conforms to the SignedOrder interface. - * @param takerAssetFillAmount The amount of the order (in taker asset baseUnits) that you wish to fill. - * @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async fillOrKillOrderAsync( - signedOrder: SignedOrder, - takerAssetFillAmount: BigNumber, - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); - assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * Attempts to fill a specific amount of an order. If the entire amount specified cannot be filled, +// * the fill order is abandoned. +// * @param signedOrder An object that conforms to the SignedOrder interface. +// * @param takerAssetFillAmount The amount of the order (in taker asset baseUnits) that you wish to fill. +// * @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async fillOrKillOrderAsync( +// signedOrder: SignedOrder, +// takerAssetFillAmount: BigNumber, +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); +// assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const data = this._exchangeInstance - .fillOrKillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, [signedOrder], orderTransactionOpts); - return txHash; - } +// const data = this._exchangeInstance +// .fillOrKillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, [signedOrder], orderTransactionOpts); +// return txHash; +// } - /** - * Batch version of fillOrderAsync. Executes multiple fills atomically in a single transaction. - * Under-the-hood, this method uses the `feeRecipientAddress`s of the orders to looks up the coordinator server endpoints - * registered in the coordinator registry contract. It requests a signature from each coordinator server before - * submitting the orders and signatures as a 0x transaction to the coordinator extension contract, which validates the - * signatures and then fills the order through the Exchange contract. - * If any `feeRecipientAddress` in the batch is not registered to a coordinator server, the whole batch fails. - * @param signedOrders An array of signed orders to fill. - * @param takerAssetFillAmounts The amounts of the orders (in taker asset baseUnits) that you wish to fill. - * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async batchFillOrdersAsync( - signedOrders: SignedOrder[], - takerAssetFillAmounts: BigNumber[], - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); - for (const takerAssetFillAmount of takerAssetFillAmounts) { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - } - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * Batch version of fillOrderAsync. Executes multiple fills atomically in a single transaction. +// * Under-the-hood, this method uses the `feeRecipientAddress`s of the orders to looks up the coordinator server endpoints +// * registered in the coordinator registry contract. It requests a signature from each coordinator server before +// * submitting the orders and signatures as a 0x transaction to the coordinator extension contract, which validates the +// * signatures and then fills the order through the Exchange contract. +// * If any `feeRecipientAddress` in the batch is not registered to a coordinator server, the whole batch fails. +// * @param signedOrders An array of signed orders to fill. +// * @param takerAssetFillAmounts The amounts of the orders (in taker asset baseUnits) that you wish to fill. +// * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async batchFillOrdersAsync( +// signedOrders: SignedOrder[], +// takerAssetFillAmounts: BigNumber[], +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); +// for (const takerAssetFillAmount of takerAssetFillAmounts) { +// assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); +// } +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const signatures = signedOrders.map(o => o.signature); - const data = this._exchangeInstance - .batchFillOrders(signedOrders, takerAssetFillAmounts, signatures) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); - return txHash; - } +// const signatures = signedOrders.map(o => o.signature); +// const data = this._exchangeInstance +// .batchFillOrders(signedOrders, takerAssetFillAmounts, signatures) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); +// return txHash; +// } - /** - * No throw version of batchFillOrdersAsync - * @param signedOrders An array of signed orders to fill. - * @param takerAssetFillAmounts The amounts of the orders (in taker asset baseUnits) that you wish to fill. - * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async batchFillOrdersNoThrowAsync( - signedOrders: SignedOrder[], - takerAssetFillAmounts: BigNumber[], - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); - for (const takerAssetFillAmount of takerAssetFillAmounts) { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - } - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * No throw version of batchFillOrdersAsync +// * @param signedOrders An array of signed orders to fill. +// * @param takerAssetFillAmounts The amounts of the orders (in taker asset baseUnits) that you wish to fill. +// * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async batchFillOrdersNoThrowAsync( +// signedOrders: SignedOrder[], +// takerAssetFillAmounts: BigNumber[], +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); +// for (const takerAssetFillAmount of takerAssetFillAmounts) { +// assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); +// } +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const signatures = signedOrders.map(o => o.signature); - const data = this._exchangeInstance - .batchFillOrdersNoThrow(signedOrders, takerAssetFillAmounts, signatures) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); - return txHash; - } +// const signatures = signedOrders.map(o => o.signature); +// const data = this._exchangeInstance +// .batchFillOrdersNoThrow(signedOrders, takerAssetFillAmounts, signatures) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); +// return txHash; +// } - /** - * Batch version of fillOrKillOrderAsync. Executes multiple fills atomically in a single transaction. - * @param signedOrders An array of signed orders to fill. - * @param takerAssetFillAmounts The amounts of the orders (in taker asset baseUnits) that you wish to fill. - * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async batchFillOrKillOrdersAsync( - signedOrders: SignedOrder[], - takerAssetFillAmounts: BigNumber[], - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); - for (const takerAssetFillAmount of takerAssetFillAmounts) { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - } - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * Batch version of fillOrKillOrderAsync. Executes multiple fills atomically in a single transaction. +// * @param signedOrders An array of signed orders to fill. +// * @param takerAssetFillAmounts The amounts of the orders (in taker asset baseUnits) that you wish to fill. +// * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async batchFillOrKillOrdersAsync( +// signedOrders: SignedOrder[], +// takerAssetFillAmounts: BigNumber[], +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); +// for (const takerAssetFillAmount of takerAssetFillAmounts) { +// assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); +// } +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const signatures = signedOrders.map(o => o.signature); - const data = this._exchangeInstance - .batchFillOrKillOrders(signedOrders, takerAssetFillAmounts, signatures) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); - return txHash; - } +// const signatures = signedOrders.map(o => o.signature); +// const data = this._exchangeInstance +// .batchFillOrKillOrders(signedOrders, takerAssetFillAmounts, signatures) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); +// return txHash; +// } - /** - * No throw version of marketBuyOrdersAsync - * @param signedOrders An array of signed orders to fill. - * @param makerAssetFillAmount Maker asset fill amount. - * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async marketBuyOrdersNoThrowAsync( - signedOrders: SignedOrder[], - makerAssetFillAmount: BigNumber, - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * No throw version of marketBuyOrdersAsync +// * @param signedOrders An array of signed orders to fill. +// * @param makerAssetFillAmount Maker asset fill amount. +// * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async marketBuyOrdersNoThrowAsync( +// signedOrders: SignedOrder[], +// makerAssetFillAmount: BigNumber, +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); +// assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const signatures = signedOrders.map(o => o.signature); - const data = this._exchangeInstance - .marketBuyOrdersNoThrow(signedOrders, makerAssetFillAmount, signatures) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); - return txHash; - } +// const signatures = signedOrders.map(o => o.signature); +// const data = this._exchangeInstance +// .marketBuyOrdersNoThrow(signedOrders, makerAssetFillAmount, signatures) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); +// return txHash; +// } - /** - * No throw version of marketSellOrdersAsync - * @param signedOrders An array of signed orders to fill. - * @param takerAssetFillAmount Taker asset fill amount. - * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied - * Provider provided at instantiation. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async marketSellOrdersNoThrowAsync( - signedOrders: SignedOrder[], - takerAssetFillAmount: BigNumber, - takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isETHAddressHex('takerAddress', takerAddress); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); +// /** +// * No throw version of marketSellOrdersAsync +// * @param signedOrders An array of signed orders to fill. +// * @param takerAssetFillAmount Taker asset fill amount. +// * @param takerAddress The user Ethereum address who would like to fill these orders. Must be available via the supplied +// * Provider provided at instantiation. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async marketSellOrdersNoThrowAsync( +// signedOrders: SignedOrder[], +// takerAssetFillAmount: BigNumber, +// takerAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); +// assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); +// assert.isETHAddressHex('takerAddress', takerAddress); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const signatures = signedOrders.map(o => o.signature); - const data = this._exchangeInstance - .marketSellOrdersNoThrow(signedOrders, takerAssetFillAmount, signatures) - .getABIEncodedTransactionData(); - const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); - return txHash; - } +// const signatures = signedOrders.map(o => o.signature); +// const data = this._exchangeInstance +// .marketSellOrdersNoThrow(signedOrders, takerAssetFillAmount, signatures) +// .getABIEncodedTransactionData(); +// const txHash = await this._handleFillsAsync(data, takerAddress, signedOrders, orderTransactionOpts); +// return txHash; +// } - /** - * Soft cancel a given order. - * Soft cancels are recorded only on coordinator operator servers and do not involve an Ethereum transaction. - * See [soft cancels](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/coordinator-specification.md#soft-cancels). - * @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel. - * @return CoordinatorServerCancellationResponse. See [Cancellation Response](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/coordinator-specification.md#response). - */ - public async softCancelOrderAsync(order: Order | SignedOrder): Promise { - assert.doesConformToSchema('order', order, schemas.orderSchema); - assert.isETHAddressHex('feeRecipientAddress', order.feeRecipientAddress); - assert.isSenderAddressAsync('makerAddress', order.makerAddress, this._web3Wrapper); +// /** +// * Soft cancel a given order. +// * Soft cancels are recorded only on coordinator operator servers and do not involve an Ethereum transaction. +// * See [soft cancels](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/coordinator-specification.md#soft-cancels). +// * @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel. +// * @return CoordinatorServerCancellationResponse. See [Cancellation Response](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/coordinator-specification.md#response). +// */ +// public async softCancelOrderAsync(order: Order | SignedOrder): Promise { +// assert.doesConformToSchema('order', order, schemas.orderSchema); +// assert.isETHAddressHex('feeRecipientAddress', order.feeRecipientAddress); +// assert.isSenderAddressAsync('makerAddress', order.makerAddress, this._web3Wrapper); - const data = this._exchangeInstance.cancelOrder(order).getABIEncodedTransactionData(); - const transaction = await this._generateSignedZeroExTransactionAsync(data, order.makerAddress); - const endpoint = await this._getServerEndpointOrThrowAsync(order.feeRecipientAddress); +// const data = this._exchangeInstance.cancelOrder(order).getABIEncodedTransactionData(); +// const transaction = await this._generateSignedZeroExTransactionAsync(data, order.makerAddress); +// const endpoint = await this._getServerEndpointOrThrowAsync(order.feeRecipientAddress); - const response = await this._executeServerRequestAsync(transaction, order.makerAddress, endpoint); - if (response.isError) { - const approvedOrders = new Array(); - const cancellations = new Array(); - const errors = [ - { - ...response, - orders: [order], - }, - ]; - throw new CoordinatorServerError( - CoordinatorServerErrorMsg.CancellationFailed, - approvedOrders, - cancellations, - errors, - ); - } else { - return response.body as CoordinatorServerCancellationResponse; - } - } +// const response = await this._executeServerRequestAsync(transaction, order.makerAddress, endpoint); +// if (response.isError) { +// const approvedOrders = new Array(); +// const cancellations = new Array(); +// const errors = [ +// { +// ...response, +// orders: [order], +// }, +// ]; +// throw new CoordinatorServerError( +// CoordinatorServerErrorMsg.CancellationFailed, +// approvedOrders, +// cancellations, +// errors, +// ); +// } else { +// return response.body as CoordinatorServerCancellationResponse; +// } +// } - /** - * Batch version of softCancelOrderAsync. Requests multiple soft cancels - * @param orders An array of orders to cancel. - * @return CoordinatorServerCancellationResponse. See [Cancellation Response](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/coordinator-specification.md#response). - */ - public async batchSoftCancelOrdersAsync(orders: SignedOrder[]): Promise { - assert.doesConformToSchema('orders', orders, schemas.ordersSchema); - const makerAddress = getMakerAddressOrThrow(orders); - assert.isSenderAddressAsync('makerAddress', makerAddress, this._web3Wrapper); - const data = this._exchangeInstance.batchCancelOrders(orders).getABIEncodedTransactionData(); +// /** +// * Batch version of softCancelOrderAsync. Requests multiple soft cancels +// * @param orders An array of orders to cancel. +// * @return CoordinatorServerCancellationResponse. See [Cancellation Response](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/coordinator-specification.md#response). +// */ +// public async batchSoftCancelOrdersAsync(orders: SignedOrder[]): Promise { +// assert.doesConformToSchema('orders', orders, schemas.ordersSchema); +// const makerAddress = getMakerAddressOrThrow(orders); +// assert.isSenderAddressAsync('makerAddress', makerAddress, this._web3Wrapper); +// const data = this._exchangeInstance.batchCancelOrders(orders).getABIEncodedTransactionData(); - const serverEndpointsToOrders = await this._mapServerEndpointsToOrdersAsync(orders); +// const serverEndpointsToOrders = await this._mapServerEndpointsToOrdersAsync(orders); - // make server requests - const errorResponses: CoordinatorServerResponse[] = []; - const successResponses: CoordinatorServerCancellationResponse[] = []; - const transaction = await this._generateSignedZeroExTransactionAsync(data, makerAddress); - for (const endpoint of Object.keys(serverEndpointsToOrders)) { - const response = await this._executeServerRequestAsync(transaction, makerAddress, endpoint); - if (response.isError) { - errorResponses.push(response); - } else { - successResponses.push(response.body as CoordinatorServerCancellationResponse); - } - } +// // make server requests +// const errorResponses: CoordinatorServerResponse[] = []; +// const successResponses: CoordinatorServerCancellationResponse[] = []; +// const transaction = await this._generateSignedZeroExTransactionAsync(data, makerAddress); +// for (const endpoint of Object.keys(serverEndpointsToOrders)) { +// const response = await this._executeServerRequestAsync(transaction, makerAddress, endpoint); +// if (response.isError) { +// errorResponses.push(response); +// } else { +// successResponses.push(response.body as CoordinatorServerCancellationResponse); +// } +// } - // if no errors - if (errorResponses.length === 0) { - return successResponses; - } else { - // lookup orders with errors - const errorsWithOrders = errorResponses.map(resp => { - const endpoint = resp.coordinatorOperator; - const _orders = serverEndpointsToOrders[endpoint]; - return { - ...resp, - orders: _orders, - }; - }); +// // if no errors +// if (errorResponses.length === 0) { +// return successResponses; +// } else { +// // lookup orders with errors +// const errorsWithOrders = errorResponses.map(resp => { +// const endpoint = resp.coordinatorOperator; +// const _orders = serverEndpointsToOrders[endpoint]; +// return { +// ...resp, +// orders: _orders, +// }; +// }); - const approvedOrders = new Array(); - const cancellations = successResponses; - // return errors and approvals - throw new CoordinatorServerError( - CoordinatorServerErrorMsg.CancellationFailed, - approvedOrders, - cancellations, - errorsWithOrders, - ); - } - } +// const approvedOrders = new Array(); +// const cancellations = successResponses; +// // return errors and approvals +// throw new CoordinatorServerError( +// CoordinatorServerErrorMsg.CancellationFailed, +// approvedOrders, +// cancellations, +// errorsWithOrders, +// ); +// } +// } - /** - * Cancels an order on-chain by submitting an Ethereum transaction. - * @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async hardCancelOrderAsync( - order: Order | SignedOrder, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('order', order, schemas.orderSchema); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('makerAddress', order.makerAddress, this._web3Wrapper); +// /** +// * Cancels an order on-chain by submitting an Ethereum transaction. +// * @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async hardCancelOrderAsync( +// order: Order | SignedOrder, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('order', order, schemas.orderSchema); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('makerAddress', order.makerAddress, this._web3Wrapper); - const data = this._exchangeInstance.cancelOrder(order).getABIEncodedTransactionData(); - const transaction = await this._generateSignedZeroExTransactionAsync(data, order.makerAddress); +// const data = this._exchangeInstance.cancelOrder(order).getABIEncodedTransactionData(); +// const transaction = await this._generateSignedZeroExTransactionAsync(data, order.makerAddress); - const approvalSignatures = new Array(); - const approvalExpirationTimeSeconds = new Array(); - const txHash = await this._submitCoordinatorTransactionAsync( - transaction, - order.makerAddress, - transaction.signature, - approvalExpirationTimeSeconds, - approvalSignatures, - orderTransactionOpts, - ); - return txHash; - } +// const approvalSignatures = new Array(); +// const approvalExpirationTimeSeconds = new Array(); +// const txHash = await this._submitCoordinatorTransactionAsync( +// transaction, +// order.makerAddress, +// transaction.signature, +// approvalExpirationTimeSeconds, +// approvalSignatures, +// orderTransactionOpts, +// ); +// return txHash; +// } - /** - * Batch version of hardCancelOrderAsync. Cancels orders on-chain by submitting an Ethereum transaction. - * Executes multiple cancels atomically in a single transaction. - * @param orders An array of orders to cancel. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async batchHardCancelOrdersAsync( - orders: SignedOrder[], - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.doesConformToSchema('orders', orders, schemas.ordersSchema); - const makerAddress = getMakerAddressOrThrow(orders); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('makerAddress', makerAddress, this._web3Wrapper); +// /** +// * Batch version of hardCancelOrderAsync. Cancels orders on-chain by submitting an Ethereum transaction. +// * Executes multiple cancels atomically in a single transaction. +// * @param orders An array of orders to cancel. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async batchHardCancelOrdersAsync( +// orders: SignedOrder[], +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.doesConformToSchema('orders', orders, schemas.ordersSchema); +// const makerAddress = getMakerAddressOrThrow(orders); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('makerAddress', makerAddress, this._web3Wrapper); - const data = this._exchangeInstance.batchCancelOrders(orders).getABIEncodedTransactionData(); - const transaction = await this._generateSignedZeroExTransactionAsync(data, makerAddress); +// const data = this._exchangeInstance.batchCancelOrders(orders).getABIEncodedTransactionData(); +// const transaction = await this._generateSignedZeroExTransactionAsync(data, makerAddress); - const approvalSignatures = new Array(); - const approvalExpirationTimeSeconds = new Array(); - const txHash = await this._submitCoordinatorTransactionAsync( - transaction, - makerAddress, - transaction.signature, - approvalExpirationTimeSeconds, - approvalSignatures, - orderTransactionOpts, - ); - return txHash; - } +// const approvalSignatures = new Array(); +// const approvalExpirationTimeSeconds = new Array(); +// const txHash = await this._submitCoordinatorTransactionAsync( +// transaction, +// makerAddress, +// transaction.signature, +// approvalExpirationTimeSeconds, +// approvalSignatures, +// orderTransactionOpts, +// ); +// return txHash; +// } - /** - * Cancels orders on-chain by submitting an Ethereum transaction. - * Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch - * and senderAddress equal to coordinator extension contract address. - * @param targetOrderEpoch Target order epoch. - * @param senderAddress Address that should send the transaction. - * @param orderTransactionOpts Optional arguments this method accepts. - * @return Transaction hash. - */ - @decorators.asyncZeroExErrorHandler - public async hardCancelOrdersUpToAsync( - targetOrderEpoch: BigNumber, - senderAddress: string, - orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, - ): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); - await assert.isSenderAddressAsync('senderAddress', senderAddress, this._web3Wrapper); +// /** +// * Cancels orders on-chain by submitting an Ethereum transaction. +// * Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch +// * and senderAddress equal to coordinator extension contract address. +// * @param targetOrderEpoch Target order epoch. +// * @param senderAddress Address that should send the transaction. +// * @param orderTransactionOpts Optional arguments this method accepts. +// * @return Transaction hash. +// */ +// @decorators.asyncZeroExErrorHandler +// public async hardCancelOrdersUpToAsync( +// targetOrderEpoch: BigNumber, +// senderAddress: string, +// orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, +// ): Promise { +// assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); +// assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); +// await assert.isSenderAddressAsync('senderAddress', senderAddress, this._web3Wrapper); - const data = this._exchangeInstance.cancelOrdersUpTo(targetOrderEpoch).getABIEncodedTransactionData(); - const transaction = await this._generateSignedZeroExTransactionAsync(data, senderAddress); +// const data = this._exchangeInstance.cancelOrdersUpTo(targetOrderEpoch).getABIEncodedTransactionData(); +// const transaction = await this._generateSignedZeroExTransactionAsync(data, senderAddress); - const approvalSignatures = new Array(); - const approvalExpirationTimeSeconds = new Array(); - const txHash = await this._submitCoordinatorTransactionAsync( - transaction, - senderAddress, - transaction.signature, - approvalExpirationTimeSeconds, - approvalSignatures, - orderTransactionOpts, - ); - return txHash; - } +// const approvalSignatures = new Array(); +// const approvalExpirationTimeSeconds = new Array(); +// const txHash = await this._submitCoordinatorTransactionAsync( +// transaction, +// senderAddress, +// transaction.signature, +// approvalExpirationTimeSeconds, +// approvalSignatures, +// orderTransactionOpts, +// ); +// return txHash; +// } - /** - * Validates that the 0x transaction has been approved by all of the feeRecipients that correspond to each order in the transaction's Exchange calldata. - * Throws an error if the transaction approvals are not valid. Will not detect failures that would occur when the transaction is executed on the Exchange contract. - * @param transaction 0x transaction containing salt, signerAddress, and data. - * @param txOrigin Required signer of Ethereum transaction calling this function. - * @param transactionSignature Proof that the transaction has been signed by the signer. - * @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires. - * @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata. - */ - public async assertValidCoordinatorApprovalsOrThrowAsync( - transaction: ZeroExTransaction, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): Promise { - assert.doesConformToSchema('transaction', transaction, schemas.zeroExTransactionSchema); - assert.isETHAddressHex('txOrigin', txOrigin); - assert.isHexString('transactionSignature', transactionSignature); - for (const expirationTime of approvalExpirationTimeSeconds) { - assert.isBigNumber('expirationTime', expirationTime); - } - for (const approvalSignature of approvalSignatures) { - assert.isHexString('approvalSignature', approvalSignature); - } +// /** +// * Validates that the 0x transaction has been approved by all of the feeRecipients that correspond to each order in the transaction's Exchange calldata. +// * Throws an error if the transaction approvals are not valid. Will not detect failures that would occur when the transaction is executed on the Exchange contract. +// * @param transaction 0x transaction containing salt, signerAddress, and data. +// * @param txOrigin Required signer of Ethereum transaction calling this function. +// * @param transactionSignature Proof that the transaction has been signed by the signer. +// * @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires. +// * @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata. +// */ +// public async assertValidCoordinatorApprovalsOrThrowAsync( +// transaction: ZeroExTransaction, +// txOrigin: string, +// transactionSignature: string, +// approvalExpirationTimeSeconds: BigNumber[], +// approvalSignatures: string[], +// ): Promise { +// assert.doesConformToSchema('transaction', transaction, schemas.zeroExTransactionSchema); +// assert.isETHAddressHex('txOrigin', txOrigin); +// assert.isHexString('transactionSignature', transactionSignature); +// for (const expirationTime of approvalExpirationTimeSeconds) { +// assert.isBigNumber('expirationTime', expirationTime); +// } +// for (const approvalSignature of approvalSignatures) { +// assert.isHexString('approvalSignature', approvalSignature); +// } - await this._contractInstance - .assertValidCoordinatorApprovals( - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ) - .callAsync(); - } +// await this._contractInstance +// .assertValidCoordinatorApprovals( +// transaction, +// txOrigin, +// transactionSignature, +// approvalExpirationTimeSeconds, +// approvalSignatures, +// ) +// .callAsync(); +// } - /** - * Recovers the address of a signer given a hash and signature. - * @param hash Any 32 byte hash. - * @param signature Proof that the hash has been signed by signer. - * @returns Signer address. - */ - public async getSignerAddressAsync(hash: string, signature: string): Promise { - assert.isHexString('hash', hash); - assert.isHexString('signature', signature); - const signerAddress = await this._contractInstance.getSignerAddress(hash, signature).callAsync(); - return signerAddress; - } +// /** +// * Recovers the address of a signer given a hash and signature. +// * @param hash Any 32 byte hash. +// * @param signature Proof that the hash has been signed by signer. +// * @returns Signer address. +// */ +// public async getSignerAddressAsync(hash: string, signature: string): Promise { +// assert.isHexString('hash', hash); +// assert.isHexString('signature', signature); +// const signerAddress = await this._contractInstance.getSignerAddress(hash, signature).callAsync(); +// return signerAddress; +// } - private async _handleFillsAsync( - data: string, - takerAddress: string, - signedOrders: SignedOrder[], - orderTransactionOpts: OrderTransactionOpts, - ): Promise { - const coordinatorOrders = signedOrders.filter(o => o.senderAddress === this.address); - const serverEndpointsToOrders = await this._mapServerEndpointsToOrdersAsync(coordinatorOrders); +// private async _handleFillsAsync( +// data: string, +// takerAddress: string, +// signedOrders: SignedOrder[], +// orderTransactionOpts: OrderTransactionOpts, +// ): Promise { +// const coordinatorOrders = signedOrders.filter(o => o.senderAddress === this.address); +// const serverEndpointsToOrders = await this._mapServerEndpointsToOrdersAsync(coordinatorOrders); - // make server requests - const errorResponses: CoordinatorServerResponse[] = []; - const approvalResponses: CoordinatorServerResponse[] = []; - const transaction = await this._generateSignedZeroExTransactionAsync(data, takerAddress); - for (const endpoint of Object.keys(serverEndpointsToOrders)) { - const response = await this._executeServerRequestAsync(transaction, takerAddress, endpoint); - if (response.isError) { - errorResponses.push(response); - } else { - approvalResponses.push(response); - } - } +// // make server requests +// const errorResponses: CoordinatorServerResponse[] = []; +// const approvalResponses: CoordinatorServerResponse[] = []; +// const transaction = await this._generateSignedZeroExTransactionAsync(data, takerAddress); +// for (const endpoint of Object.keys(serverEndpointsToOrders)) { +// const response = await this._executeServerRequestAsync(transaction, takerAddress, endpoint); +// if (response.isError) { +// errorResponses.push(response); +// } else { +// approvalResponses.push(response); +// } +// } - // if no errors - if (errorResponses.length === 0) { - // concatenate all approval responses - const allApprovals = approvalResponses.map(resp => - formatRawResponse(resp.body as CoordinatorServerApprovalRawResponse), - ); +// // if no errors +// if (errorResponses.length === 0) { +// // concatenate all approval responses +// const allApprovals = approvalResponses.map(resp => +// formatRawResponse(resp.body as CoordinatorServerApprovalRawResponse), +// ); - const allSignatures = flatten(allApprovals.map(a => a.signatures)); - const allExpirationTimes = flatten(allApprovals.map(a => a.expirationTimeSeconds)); +// const allSignatures = flatten(allApprovals.map(a => a.signatures)); +// const allExpirationTimes = flatten(allApprovals.map(a => a.expirationTimeSeconds)); - // submit transaction with approvals - const txHash = await this._submitCoordinatorTransactionAsync( - transaction, - takerAddress, - transaction.signature, - allExpirationTimes, - allSignatures, - orderTransactionOpts, - ); - return txHash; - } else { - // format errors and approvals - // concatenate approvals - const notCoordinatorOrders = signedOrders.filter(o => o.senderAddress !== this.address); - const approvedOrdersNested = approvalResponses.map(resp => { - const endpoint = resp.coordinatorOperator; - const orders = serverEndpointsToOrders[endpoint]; - return orders; - }); - const approvedOrders = flatten(approvedOrdersNested.concat(notCoordinatorOrders)); +// // submit transaction with approvals +// const txHash = await this._submitCoordinatorTransactionAsync( +// transaction, +// takerAddress, +// transaction.signature, +// allExpirationTimes, +// allSignatures, +// orderTransactionOpts, +// ); +// return txHash; +// } else { +// // format errors and approvals +// // concatenate approvals +// const notCoordinatorOrders = signedOrders.filter(o => o.senderAddress !== this.address); +// const approvedOrdersNested = approvalResponses.map(resp => { +// const endpoint = resp.coordinatorOperator; +// const orders = serverEndpointsToOrders[endpoint]; +// return orders; +// }); +// const approvedOrders = flatten(approvedOrdersNested.concat(notCoordinatorOrders)); - // lookup orders with errors - const errorsWithOrders = errorResponses.map(resp => { - const endpoint = resp.coordinatorOperator; - const orders = serverEndpointsToOrders[endpoint]; - return { - ...resp, - orders, - }; - }); +// // lookup orders with errors +// const errorsWithOrders = errorResponses.map(resp => { +// const endpoint = resp.coordinatorOperator; +// const orders = serverEndpointsToOrders[endpoint]; +// return { +// ...resp, +// orders, +// }; +// }); - // throw informative error - const cancellations = new Array(); - throw new CoordinatorServerError( - CoordinatorServerErrorMsg.FillFailed, - approvedOrders, - cancellations, - errorsWithOrders, - ); - } - function formatRawResponse( - rawResponse: CoordinatorServerApprovalRawResponse, - ): CoordinatorServerApprovalResponse { - return { - signatures: ([] as string[]).concat(rawResponse.signatures), - expirationTimeSeconds: ([] as BigNumber[]).concat( - Array(rawResponse.signatures.length).fill(rawResponse.expirationTimeSeconds), - ), - }; - } - } +// // throw informative error +// const cancellations = new Array(); +// throw new CoordinatorServerError( +// CoordinatorServerErrorMsg.FillFailed, +// approvedOrders, +// cancellations, +// errorsWithOrders, +// ); +// } +// function formatRawResponse( +// rawResponse: CoordinatorServerApprovalRawResponse, +// ): CoordinatorServerApprovalResponse { +// return { +// signatures: ([] as string[]).concat(rawResponse.signatures), +// expirationTimeSeconds: ([] as BigNumber[]).concat( +// Array(rawResponse.signatures.length).fill(rawResponse.expirationTimeSeconds), +// ), +// }; +// } +// } - private async _getServerEndpointOrThrowAsync(feeRecipientAddress: string): Promise { - const cached = this._feeRecipientToEndpoint[feeRecipientAddress]; - const endpoint = - cached !== undefined - ? cached - : await _fetchServerEndpointOrThrowAsync(feeRecipientAddress, this._registryInstance); - return endpoint; +// private async _getServerEndpointOrThrowAsync(feeRecipientAddress: string): Promise { +// const cached = this._feeRecipientToEndpoint[feeRecipientAddress]; +// const endpoint = +// cached !== undefined +// ? cached +// : await _fetchServerEndpointOrThrowAsync(feeRecipientAddress, this._registryInstance); +// return endpoint; - async function _fetchServerEndpointOrThrowAsync( - feeRecipient: string, - registryInstance: CoordinatorRegistryContract, - ): Promise { - const coordinatorOperatorEndpoint = await registryInstance.getCoordinatorEndpoint(feeRecipient).callAsync(); - if (coordinatorOperatorEndpoint === '' || coordinatorOperatorEndpoint === undefined) { - throw new Error( - `No Coordinator server endpoint found in Coordinator Registry for feeRecipientAddress: ${feeRecipient}. Registry contract address: ${ - registryInstance.address - }`, - ); - } - return coordinatorOperatorEndpoint; - } - } +// async function _fetchServerEndpointOrThrowAsync( +// feeRecipient: string, +// registryInstance: CoordinatorRegistryContract, +// ): Promise { +// const coordinatorOperatorEndpoint = await registryInstance.getCoordinatorEndpoint(feeRecipient).callAsync(); +// if (coordinatorOperatorEndpoint === '' || coordinatorOperatorEndpoint === undefined) { +// throw new Error( +// `No Coordinator server endpoint found in Coordinator Registry for feeRecipientAddress: ${feeRecipient}. Registry contract address: ${ +// registryInstance.address +// }`, +// ); +// } +// return coordinatorOperatorEndpoint; +// } +// } - private async _generateSignedZeroExTransactionAsync( - data: string, - signerAddress: string, - ): Promise { - const transaction: ZeroExTransaction = { - salt: generatePseudoRandomSalt(), - signerAddress, - data, - domain: { - verifyingContract: this.exchangeAddress, - chainId: await this._web3Wrapper.getChainIdAsync(), - }, - // HACK (xianny): arbitrary numbers for now - expirationTimeSeconds: new BigNumber(5), - gasPrice: new BigNumber(1), - }; - const signedTransaction = await signatureUtils.ecSignTransactionAsync( - this._web3Wrapper.getProvider(), - transaction, - transaction.signerAddress, - ); +// private async _generateSignedZeroExTransactionAsync( +// data: string, +// signerAddress: string, +// ): Promise { +// const transaction: ZeroExTransaction = { +// salt: generatePseudoRandomSalt(), +// signerAddress, +// data, +// domain: { +// verifyingContract: this.exchangeAddress, +// chainId: await this._web3Wrapper.getChainIdAsync(), +// }, +// // HACK (xianny): arbitrary numbers for now +// expirationTimeSeconds: new BigNumber(5), +// gasPrice: new BigNumber(1), +// }; +// const signedTransaction = await signatureUtils.ecSignTransactionAsync( +// this._web3Wrapper.getProvider(), +// transaction, +// transaction.signerAddress, +// ); - return signedTransaction; - } +// return signedTransaction; +// } - private async _executeServerRequestAsync( - signedTransaction: SignedZeroExTransaction, - txOrigin: string, - endpoint: string, - ): Promise { - const requestPayload = { - signedTransaction, - txOrigin, - }; - const response = await fetchAsync(`${endpoint}/v1/request_transaction?chainId=${this.chainId}`, { - body: JSON.stringify(requestPayload), - method: 'POST', - headers: { - 'Content-Type': 'application/json; charset=utf-8', - }, - }); +// private async _executeServerRequestAsync( +// signedTransaction: SignedZeroExTransaction, +// txOrigin: string, +// endpoint: string, +// ): Promise { +// const requestPayload = { +// signedTransaction, +// txOrigin, +// }; +// const response = await fetchAsync(`${endpoint}/v1/request_transaction?chainId=${this.chainId}`, { +// body: JSON.stringify(requestPayload), +// method: 'POST', +// headers: { +// 'Content-Type': 'application/json; charset=utf-8', +// }, +// }); - const isError = response.status !== HttpStatus.OK; - const isValidationError = response.status === HttpStatus.BAD_REQUEST; - const json = isError && !isValidationError ? undefined : await response.json(); +// const isError = response.status !== HttpStatus.OK; +// const isValidationError = response.status === HttpStatus.BAD_REQUEST; +// const json = isError && !isValidationError ? undefined : await response.json(); - const result = { - isError, - status: response.status, - body: isError ? undefined : json, - error: isError ? json : undefined, - request: requestPayload, - coordinatorOperator: endpoint, - }; +// const result = { +// isError, +// status: response.status, +// body: isError ? undefined : json, +// error: isError ? json : undefined, +// request: requestPayload, +// coordinatorOperator: endpoint, +// }; - return result; - } +// return result; +// } - private async _submitCoordinatorTransactionAsync( - transaction: CoordinatorTransaction, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - orderTransactionOpts: OrderTransactionOpts, - ): Promise { - if (orderTransactionOpts.shouldValidate) { - await this._contractInstance - .executeTransaction( - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ) - .callAsync({ - from: txOrigin, - gas: orderTransactionOpts.gasLimit, - gasPrice: orderTransactionOpts.gasPrice, - nonce: orderTransactionOpts.nonce, - }); - } - const txHash = await this._contractInstance - .executeTransaction( - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ) - .sendTransactionAsync({ - from: txOrigin, - gas: orderTransactionOpts.gasLimit, - gasPrice: orderTransactionOpts.gasPrice, - nonce: orderTransactionOpts.nonce, - }); - return txHash; - } +// private async _submitCoordinatorTransactionAsync( +// transaction: CoordinatorTransaction, +// txOrigin: string, +// transactionSignature: string, +// approvalExpirationTimeSeconds: BigNumber[], +// approvalSignatures: string[], +// orderTransactionOpts: OrderTransactionOpts, +// ): Promise { +// if (orderTransactionOpts.shouldValidate) { +// await this._contractInstance +// .executeTransaction( +// transaction, +// txOrigin, +// transactionSignature, +// approvalExpirationTimeSeconds, +// approvalSignatures, +// ) +// .callAsync({ +// from: txOrigin, +// gas: orderTransactionOpts.gasLimit, +// gasPrice: orderTransactionOpts.gasPrice, +// nonce: orderTransactionOpts.nonce, +// }); +// } +// const txHash = await this._contractInstance +// .executeTransaction( +// transaction, +// txOrigin, +// transactionSignature, +// approvalExpirationTimeSeconds, +// approvalSignatures, +// ) +// .sendTransactionAsync({ +// from: txOrigin, +// gas: orderTransactionOpts.gasLimit, +// gasPrice: orderTransactionOpts.gasPrice, +// nonce: orderTransactionOpts.nonce, +// }); +// return txHash; +// } - private async _mapServerEndpointsToOrdersAsync( - coordinatorOrders: SignedOrder[], - ): Promise<{ [endpoint: string]: SignedOrder[] }> { - const feeRecipientsToOrders: { [feeRecipient: string]: SignedOrder[] } = {}; - for (const order of coordinatorOrders) { - const feeRecipient = order.feeRecipientAddress; - if (feeRecipientsToOrders[feeRecipient] === undefined) { - feeRecipientsToOrders[feeRecipient] = [] as SignedOrder[]; - } - feeRecipientsToOrders[feeRecipient].push(order); - } - const serverEndpointsToOrders: { [endpoint: string]: SignedOrder[] } = {}; - for (const feeRecipient of Object.keys(feeRecipientsToOrders)) { - const endpoint = await this._getServerEndpointOrThrowAsync(feeRecipient); - const orders = feeRecipientsToOrders[feeRecipient]; - if (serverEndpointsToOrders[endpoint] === undefined) { - serverEndpointsToOrders[endpoint] = []; - } - serverEndpointsToOrders[endpoint] = serverEndpointsToOrders[endpoint].concat(orders); - } - return serverEndpointsToOrders; - } -} +// private async _mapServerEndpointsToOrdersAsync( +// coordinatorOrders: SignedOrder[], +// ): Promise<{ [endpoint: string]: SignedOrder[] }> { +// const feeRecipientsToOrders: { [feeRecipient: string]: SignedOrder[] } = {}; +// for (const order of coordinatorOrders) { +// const feeRecipient = order.feeRecipientAddress; +// if (feeRecipientsToOrders[feeRecipient] === undefined) { +// feeRecipientsToOrders[feeRecipient] = [] as SignedOrder[]; +// } +// feeRecipientsToOrders[feeRecipient].push(order); +// } +// const serverEndpointsToOrders: { [endpoint: string]: SignedOrder[] } = {}; +// for (const feeRecipient of Object.keys(feeRecipientsToOrders)) { +// const endpoint = await this._getServerEndpointOrThrowAsync(feeRecipient); +// const orders = feeRecipientsToOrders[feeRecipient]; +// if (serverEndpointsToOrders[endpoint] === undefined) { +// serverEndpointsToOrders[endpoint] = []; +// } +// serverEndpointsToOrders[endpoint] = serverEndpointsToOrders[endpoint].concat(orders); +// } +// return serverEndpointsToOrders; +// } +// } -function getMakerAddressOrThrow(orders: Array): string { - const uniqueMakerAddresses = new Set(orders.map(o => o.makerAddress)); - if (uniqueMakerAddresses.size > 1) { - throw new Error(`All orders in a batch must have the same makerAddress`); - } - return orders[0].makerAddress; -} +// function getMakerAddressOrThrow(orders: Array): string { +// const uniqueMakerAddresses = new Set(orders.map(o => o.makerAddress)); +// if (uniqueMakerAddresses.size > 1) { +// throw new Error(`All orders in a batch must have the same makerAddress`); +// } +// return orders[0].makerAddress; +// } // tslint:disable:max-file-line-count diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 48a6c6c80d..e9fda9231a 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -1,7 +1,6 @@ export { ContractAddresses } from '@0x/contract-addresses'; export { ContractWrappers } from './contract_wrappers'; -export { CoordinatorWrapper } from './coordinator_wrapper'; export { ExchangeEventArgs, @@ -126,14 +125,9 @@ export { export { SimpleContractArtifact, - ZeroExTransaction, - SignedOrder, - Order, SimpleStandardContractOutput, - SignedZeroExTransaction, SimpleEvmOutput, SimpleEvmBytecodeOutput, - EIP712DomainWithDefaultSchema, EventCallback, DecodedLogEvent, IndexedFilterValues, diff --git a/packages/contract-wrappers/test/coordinator_wrapper_test.ts b/packages/contract-wrappers/test/coordinator_wrapper_test.ts index ff459a4b5a..7455cdcb64 100644 --- a/packages/contract-wrappers/test/coordinator_wrapper_test.ts +++ b/packages/contract-wrappers/test/coordinator_wrapper_test.ts @@ -1,675 +1,675 @@ -import { constants, OrderFactory } from '@0x/contracts-test-utils'; -import { defaultOrmConfig, getAppAsync } from '@0x/coordinator-server'; -import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils'; -import { SignedOrder } from '@0x/types'; -import { BigNumber, fetchAsync, logUtils, providerUtils } from '@0x/utils'; -import * as chai from 'chai'; -import * as http from 'http'; -import 'mocha'; -import * as nock from 'nock'; +// import { constants, OrderFactory } from '@0x/contracts-test-utils'; +// import { defaultOrmConfig, getAppAsync } from '@0x/coordinator-server'; +// import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils'; +// import { SignedOrder } from '@0x/types'; +// import { BigNumber, fetchAsync, logUtils, providerUtils } from '@0x/utils'; +// import * as chai from 'chai'; +// import * as http from 'http'; +// import 'mocha'; +// import * as nock from 'nock'; -import { ContractWrappers } from '../src'; -import { CoordinatorRegistryContract } from '../src/index'; -import { CoordinatorServerErrorMsg } from '../src/utils/coordinator_server_types'; +// import { ContractWrappers } from '../src'; +// import { CoordinatorRegistryContract } from '../src/index'; +// import { CoordinatorServerErrorMsg } from '../src/utils/coordinator_server_types'; -import { chaiSetup } from './utils/chai_setup'; -import { migrateOnceAsync } from './utils/migrate'; -import { provider, web3Wrapper } from './utils/web3_wrapper'; +// import { chaiSetup } from './utils/chai_setup'; +// import { migrateOnceAsync } from './utils/migrate'; +// import { provider, web3Wrapper } from './utils/web3_wrapper'; -chaiSetup.configure(); -const expect = chai.expect; -const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -const coordinatorPort = '3000'; -const anotherCoordinatorPort = '4000'; -const coordinatorEndpoint = 'http://localhost:'; +// chaiSetup.configure(); +// const expect = chai.expect; +// const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); +// const coordinatorPort = '3000'; +// const anotherCoordinatorPort = '4000'; +// const coordinatorEndpoint = 'http://localhost:'; -// tslint:disable:custom-no-magic-numbers -// TODO (xianny): coordinator server must be updated to take new SignedOrder format. it returns all errors at the moment -describe.skip('CoordinatorWrapper', () => { - const takerTokenFillAmount = new BigNumber(5); +// // tslint:disable:custom-no-magic-numbers +// // TODO (xianny): coordinator server must be updated to take new SignedOrder format. it returns all errors at the moment +// describe.skip('CoordinatorWrapper', () => { +// const takerTokenFillAmount = new BigNumber(5); - let chainId: number; - let coordinatorServerApp: http.Server; - let anotherCoordinatorServerApp: http.Server; - let contractWrappers: ContractWrappers; - let orderFactory: OrderFactory; - let exchangeContractAddress: string; - let userAddresses: string[]; - let makerAddress: string; - let takerAddress: string; - let feeRecipientAddressOne: string; - let feeRecipientAddressTwo: string; - let feeRecipientAddressThree: string; - let feeRecipientAddressFour: string; +// let chainId: number; +// let coordinatorServerApp: http.Server; +// let anotherCoordinatorServerApp: http.Server; +// let contractWrappers: ContractWrappers; +// let orderFactory: OrderFactory; +// let exchangeContractAddress: string; +// let userAddresses: string[]; +// let makerAddress: string; +// let takerAddress: string; +// let feeRecipientAddressOne: string; +// let feeRecipientAddressTwo: string; +// let feeRecipientAddressThree: string; +// let feeRecipientAddressFour: string; - let makerTokenAddress: string; - let takerTokenAddress: string; - let feeTokenAddress: string; - let makerAssetData: string; - let takerAssetData: string; - let feeAssetData: string; - let txHash: string; - let signedOrder: SignedOrder; - let anotherSignedOrder: SignedOrder; - let signedOrderWithDifferentFeeRecipient: SignedOrder; - let signedOrderWithDifferentCoordinatorOperator: SignedOrder; - let coordinatorRegistryInstance: CoordinatorRegistryContract; +// let makerTokenAddress: string; +// let takerTokenAddress: string; +// let feeTokenAddress: string; +// let makerAssetData: string; +// let takerAssetData: string; +// let feeAssetData: string; +// let txHash: string; +// let signedOrder: SignedOrder; +// let anotherSignedOrder: SignedOrder; +// let signedOrderWithDifferentFeeRecipient: SignedOrder; +// let signedOrderWithDifferentCoordinatorOperator: SignedOrder; +// let coordinatorRegistryInstance: CoordinatorRegistryContract; - // for testing server error responses - let serverValidationError: any; - let serverCancellationSuccess: any; - let serverApprovalSuccess: any; +// // for testing server error responses +// let serverValidationError: any; +// let serverCancellationSuccess: any; +// let serverApprovalSuccess: any; - before(async () => { - const contractAddresses = await migrateOnceAsync(); - await blockchainLifecycle.startAsync(); - const config = { - chainId: constants.TESTRPC_CHAIN_ID, - contractAddresses, - blockPollingIntervalMs: 10, - }; - contractWrappers = new ContractWrappers(provider, config); - chainId = await providerUtils.getChainIdAsync(provider); - exchangeContractAddress = contractWrappers.exchange.address; - userAddresses = await web3Wrapper.getAvailableAddressesAsync(); - [ - , - makerAddress, - takerAddress, - feeRecipientAddressOne, - feeRecipientAddressTwo, - feeRecipientAddressThree, - feeRecipientAddressFour, - ] = userAddresses.slice(0, 7); +// before(async () => { +// const contractAddresses = await migrateOnceAsync(); +// await blockchainLifecycle.startAsync(); +// const config = { +// chainId: constants.TESTRPC_CHAIN_ID, +// contractAddresses, +// blockPollingIntervalMs: 10, +// }; +// contractWrappers = new ContractWrappers(provider, config); +// chainId = await providerUtils.getChainIdAsync(provider); +// exchangeContractAddress = contractWrappers.exchange.address; +// userAddresses = await web3Wrapper.getAvailableAddressesAsync(); +// [ +// , +// makerAddress, +// takerAddress, +// feeRecipientAddressOne, +// feeRecipientAddressTwo, +// feeRecipientAddressThree, +// feeRecipientAddressFour, +// ] = userAddresses.slice(0, 7); - [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses(); - feeTokenAddress = contractAddresses.zrxToken; - [makerAssetData, takerAssetData, feeAssetData] = [ - await contractWrappers.devUtils.encodeERC20AssetData(makerTokenAddress).callAsync(), - await contractWrappers.devUtils.encodeERC20AssetData(takerTokenAddress).callAsync(), - await contractWrappers.devUtils.encodeERC20AssetData(feeTokenAddress).callAsync(), - ]; +// [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses(); +// feeTokenAddress = contractAddresses.zrxToken; +// [makerAssetData, takerAssetData, feeAssetData] = [ +// await contractWrappers.devUtils.encodeERC20AssetData(makerTokenAddress).callAsync(), +// await contractWrappers.devUtils.encodeERC20AssetData(takerTokenAddress).callAsync(), +// await contractWrappers.devUtils.encodeERC20AssetData(feeTokenAddress).callAsync(), +// ]; - // Configure order defaults - const defaultOrderParams = { - ...constants.STATIC_ORDER_PARAMS, - makerAddress, - feeRecipientAddress: feeRecipientAddressOne, - makerAssetData, - takerAssetData, - makerFeeAssetData: feeAssetData, - takerFeeAssetData: feeAssetData, - senderAddress: contractAddresses.coordinator, - exchangeAddress: exchangeContractAddress, - chainId, - }; - const privateKey = constants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)]; - orderFactory = new OrderFactory(privateKey, defaultOrderParams); +// // Configure order defaults +// const defaultOrderParams = { +// ...constants.STATIC_ORDER_PARAMS, +// makerAddress, +// feeRecipientAddress: feeRecipientAddressOne, +// makerAssetData, +// takerAssetData, +// makerFeeAssetData: feeAssetData, +// takerFeeAssetData: feeAssetData, +// senderAddress: contractAddresses.coordinator, +// exchangeAddress: exchangeContractAddress, +// chainId, +// }; +// const privateKey = constants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)]; +// orderFactory = new OrderFactory(privateKey, defaultOrderParams); - // set up mock coordinator server - const coordinatorServerConfigs = { - HTTP_PORT: 3000, // Only used in default instantiation in 0x-coordinator-server/server.js; not used here - NETWORK_ID_TO_SETTINGS: { - // TODO: change to CHAIN_ID_TO_SETTINGS when @0x/coordinator-server is ready - [config.chainId]: { - FEE_RECIPIENTS: [ - { - ADDRESS: feeRecipientAddressOne, - PRIVATE_KEY: constants.TESTRPC_PRIVATE_KEYS[ - userAddresses.indexOf(feeRecipientAddressOne) - ].toString('hex'), - }, - { - ADDRESS: feeRecipientAddressTwo, - PRIVATE_KEY: constants.TESTRPC_PRIVATE_KEYS[ - userAddresses.indexOf(feeRecipientAddressTwo) - ].toString('hex'), - }, - { - ADDRESS: feeRecipientAddressThree, - PRIVATE_KEY: constants.TESTRPC_PRIVATE_KEYS[ - userAddresses.indexOf(feeRecipientAddressThree) - ].toString('hex'), - }, - ], - // Ethereum RPC url, only used in the default instantiation in 0x-coordinator-server/server.js - // Not used here when instantiating with the imported app - RPC_URL: 'http://ignore', - }, - }, - NETWORK_ID_TO_CONTRACT_ADDRESSES: { - // TODO: change to CHAIN_ID_TO_CONTRACT_ADDRESSES when @0x/coordinator-server is ready - [config.chainId]: contractAddresses, - }, - // Optional selective delay on fill requests - SELECTIVE_DELAY_MS: 0, - EXPIRATION_DURATION_SECONDS: 60, // 1 minute - }; - coordinatorServerApp = await getAppAsync( - { - [config.chainId]: provider, - }, - coordinatorServerConfigs, - { - name: 'coord_server_1', - type: 'sqlite', - database: ':memory:', - entities: defaultOrmConfig.entities, - cli: defaultOrmConfig.cli, - logging: defaultOrmConfig.logging, - synchronize: defaultOrmConfig.synchronize, - }, - ); +// // set up mock coordinator server +// const coordinatorServerConfigs = { +// HTTP_PORT: 3000, // Only used in default instantiation in 0x-coordinator-server/server.js; not used here +// NETWORK_ID_TO_SETTINGS: { +// // TODO: change to CHAIN_ID_TO_SETTINGS when @0x/coordinator-server is ready +// [config.chainId]: { +// FEE_RECIPIENTS: [ +// { +// ADDRESS: feeRecipientAddressOne, +// PRIVATE_KEY: constants.TESTRPC_PRIVATE_KEYS[ +// userAddresses.indexOf(feeRecipientAddressOne) +// ].toString('hex'), +// }, +// { +// ADDRESS: feeRecipientAddressTwo, +// PRIVATE_KEY: constants.TESTRPC_PRIVATE_KEYS[ +// userAddresses.indexOf(feeRecipientAddressTwo) +// ].toString('hex'), +// }, +// { +// ADDRESS: feeRecipientAddressThree, +// PRIVATE_KEY: constants.TESTRPC_PRIVATE_KEYS[ +// userAddresses.indexOf(feeRecipientAddressThree) +// ].toString('hex'), +// }, +// ], +// // Ethereum RPC url, only used in the default instantiation in 0x-coordinator-server/server.js +// // Not used here when instantiating with the imported app +// RPC_URL: 'http://ignore', +// }, +// }, +// NETWORK_ID_TO_CONTRACT_ADDRESSES: { +// // TODO: change to CHAIN_ID_TO_CONTRACT_ADDRESSES when @0x/coordinator-server is ready +// [config.chainId]: contractAddresses, +// }, +// // Optional selective delay on fill requests +// SELECTIVE_DELAY_MS: 0, +// EXPIRATION_DURATION_SECONDS: 60, // 1 minute +// }; +// coordinatorServerApp = await getAppAsync( +// { +// [config.chainId]: provider, +// }, +// coordinatorServerConfigs, +// { +// name: 'coord_server_1', +// type: 'sqlite', +// database: ':memory:', +// entities: defaultOrmConfig.entities, +// cli: defaultOrmConfig.cli, +// logging: defaultOrmConfig.logging, +// synchronize: defaultOrmConfig.synchronize, +// }, +// ); - coordinatorServerApp.listen(coordinatorPort, () => { - logUtils.log(`Coordinator SERVER API (HTTP) listening on port ${coordinatorPort}!`); - }); +// coordinatorServerApp.listen(coordinatorPort, () => { +// logUtils.log(`Coordinator SERVER API (HTTP) listening on port ${coordinatorPort}!`); +// }); - anotherCoordinatorServerApp = await getAppAsync( - { - [config.chainId]: provider, - }, - coordinatorServerConfigs, - { - type: 'sqlite', - name: 'coord_server_2', - database: ':memory:', - entities: defaultOrmConfig.entities, - cli: defaultOrmConfig.cli, - logging: defaultOrmConfig.logging, - synchronize: defaultOrmConfig.synchronize, - }, - ); +// anotherCoordinatorServerApp = await getAppAsync( +// { +// [config.chainId]: provider, +// }, +// coordinatorServerConfigs, +// { +// type: 'sqlite', +// name: 'coord_server_2', +// database: ':memory:', +// entities: defaultOrmConfig.entities, +// cli: defaultOrmConfig.cli, +// logging: defaultOrmConfig.logging, +// synchronize: defaultOrmConfig.synchronize, +// }, +// ); - anotherCoordinatorServerApp.listen(anotherCoordinatorPort, () => { - logUtils.log(`Coordinator SERVER API (HTTP) listening on port ${anotherCoordinatorPort}!`); - }); +// anotherCoordinatorServerApp.listen(anotherCoordinatorPort, () => { +// logUtils.log(`Coordinator SERVER API (HTTP) listening on port ${anotherCoordinatorPort}!`); +// }); - // setup coordinator registry - coordinatorRegistryInstance = new CoordinatorRegistryContract(contractAddresses.coordinatorRegistry, provider); +// // setup coordinator registry +// coordinatorRegistryInstance = new CoordinatorRegistryContract(contractAddresses.coordinatorRegistry, provider); - // register coordinator server - await web3Wrapper.awaitTransactionSuccessAsync( - await coordinatorRegistryInstance - .setCoordinatorEndpoint(`${coordinatorEndpoint}${coordinatorPort}`) - .sendTransactionAsync({ - from: feeRecipientAddressOne, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await coordinatorRegistryInstance - .setCoordinatorEndpoint(`${coordinatorEndpoint}${coordinatorPort}`) - .sendTransactionAsync({ - from: feeRecipientAddressTwo, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); +// // register coordinator server +// await web3Wrapper.awaitTransactionSuccessAsync( +// await coordinatorRegistryInstance +// .setCoordinatorEndpoint(`${coordinatorEndpoint}${coordinatorPort}`) +// .sendTransactionAsync({ +// from: feeRecipientAddressOne, +// }), +// constants.AWAIT_TRANSACTION_MINED_MS, +// ); +// await web3Wrapper.awaitTransactionSuccessAsync( +// await coordinatorRegistryInstance +// .setCoordinatorEndpoint(`${coordinatorEndpoint}${coordinatorPort}`) +// .sendTransactionAsync({ +// from: feeRecipientAddressTwo, +// }), +// constants.AWAIT_TRANSACTION_MINED_MS, +// ); - // register another coordinator server - await web3Wrapper.awaitTransactionSuccessAsync( - await coordinatorRegistryInstance - .setCoordinatorEndpoint(`${coordinatorEndpoint}${anotherCoordinatorPort}`) - .sendTransactionAsync({ - from: feeRecipientAddressThree, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - }); - after(async () => { - await blockchainLifecycle.revertAsync(); - }); - beforeEach(async () => { - await blockchainLifecycle.startAsync(); - signedOrder = await orderFactory.newSignedOrderAsync(); - anotherSignedOrder = await orderFactory.newSignedOrderAsync(); - signedOrderWithDifferentFeeRecipient = await orderFactory.newSignedOrderAsync({ - feeRecipientAddress: feeRecipientAddressTwo, - }); - signedOrderWithDifferentCoordinatorOperator = await orderFactory.newSignedOrderAsync({ - feeRecipientAddress: feeRecipientAddressThree, - }); - }); - afterEach(async () => { - await blockchainLifecycle.revertAsync(); - }); - describe('test setup', () => { - it('should have coordinator registry which returns an endpoint', async () => { - const setCoordinatorEndpoint = await coordinatorRegistryInstance - .getCoordinatorEndpoint(feeRecipientAddressOne) - .callAsync(); - const anotherSetCoordinatorEndpoint = await coordinatorRegistryInstance - .getCoordinatorEndpoint(feeRecipientAddressThree) - .callAsync(); - expect(setCoordinatorEndpoint).to.be.equal(`${coordinatorEndpoint}${coordinatorPort}`); - expect(anotherSetCoordinatorEndpoint).to.be.equal(`${coordinatorEndpoint}${anotherCoordinatorPort}`); - }); - it('should have coordinator server endpoints which respond to pings', async () => { - let result = await fetchAsync(`${coordinatorEndpoint}${coordinatorPort}/v1/ping`); - expect(result.status).to.be.equal(200); - expect(await result.text()).to.be.equal('pong'); +// // register another coordinator server +// await web3Wrapper.awaitTransactionSuccessAsync( +// await coordinatorRegistryInstance +// .setCoordinatorEndpoint(`${coordinatorEndpoint}${anotherCoordinatorPort}`) +// .sendTransactionAsync({ +// from: feeRecipientAddressThree, +// }), +// constants.AWAIT_TRANSACTION_MINED_MS, +// ); +// }); +// after(async () => { +// await blockchainLifecycle.revertAsync(); +// }); +// beforeEach(async () => { +// await blockchainLifecycle.startAsync(); +// signedOrder = await orderFactory.newSignedOrderAsync(); +// anotherSignedOrder = await orderFactory.newSignedOrderAsync(); +// signedOrderWithDifferentFeeRecipient = await orderFactory.newSignedOrderAsync({ +// feeRecipientAddress: feeRecipientAddressTwo, +// }); +// signedOrderWithDifferentCoordinatorOperator = await orderFactory.newSignedOrderAsync({ +// feeRecipientAddress: feeRecipientAddressThree, +// }); +// }); +// afterEach(async () => { +// await blockchainLifecycle.revertAsync(); +// }); +// describe('test setup', () => { +// it('should have coordinator registry which returns an endpoint', async () => { +// const setCoordinatorEndpoint = await coordinatorRegistryInstance +// .getCoordinatorEndpoint(feeRecipientAddressOne) +// .callAsync(); +// const anotherSetCoordinatorEndpoint = await coordinatorRegistryInstance +// .getCoordinatorEndpoint(feeRecipientAddressThree) +// .callAsync(); +// expect(setCoordinatorEndpoint).to.be.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// expect(anotherSetCoordinatorEndpoint).to.be.equal(`${coordinatorEndpoint}${anotherCoordinatorPort}`); +// }); +// it('should have coordinator server endpoints which respond to pings', async () => { +// let result = await fetchAsync(`${coordinatorEndpoint}${coordinatorPort}/v1/ping`); +// expect(result.status).to.be.equal(200); +// expect(await result.text()).to.be.equal('pong'); - result = await fetchAsync(`${coordinatorEndpoint}${anotherCoordinatorPort}/v1/ping`); - expect(result.status).to.be.equal(200); - expect(await result.text()).to.be.equal('pong'); - }); - }); - // fill handling is the same for all fill methods so we can test them all through the fillOrder and batchFillOrders interfaces - describe('fill order(s)', () => { - describe('#fillOrderAsync', () => { - it('should fill a valid order', async () => { - txHash = await contractWrappers.coordinator.fillOrderAsync( - signedOrder, - takerTokenFillAmount, - takerAddress, - ); +// result = await fetchAsync(`${coordinatorEndpoint}${anotherCoordinatorPort}/v1/ping`); +// expect(result.status).to.be.equal(200); +// expect(await result.text()).to.be.equal('pong'); +// }); +// }); +// // fill handling is the same for all fill methods so we can test them all through the fillOrder and batchFillOrders interfaces +// describe('fill order(s)', () => { +// describe('#fillOrderAsync', () => { +// it('should fill a valid order', async () => { +// txHash = await contractWrappers.coordinator.fillOrderAsync( +// signedOrder, +// takerTokenFillAmount, +// takerAddress, +// ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); - }); - describe('#batchFillOrdersAsync', () => { - it('should fill a batch of valid orders', async () => { - const signedOrders = [signedOrder, anotherSignedOrder]; - const takerAssetFillAmounts = Array(2).fill(takerTokenFillAmount); - txHash = await contractWrappers.coordinator.batchFillOrdersAsync( - signedOrders, - takerAssetFillAmounts, - takerAddress, - ); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); +// }); +// describe('#batchFillOrdersAsync', () => { +// it('should fill a batch of valid orders', async () => { +// const signedOrders = [signedOrder, anotherSignedOrder]; +// const takerAssetFillAmounts = Array(2).fill(takerTokenFillAmount); +// txHash = await contractWrappers.coordinator.batchFillOrdersAsync( +// signedOrders, +// takerAssetFillAmounts, +// takerAddress, +// ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); - it('should fill a batch of orders with different feeRecipientAddresses with the same coordinator server', async () => { - const signedOrders = [signedOrder, anotherSignedOrder, signedOrderWithDifferentFeeRecipient]; - const takerAssetFillAmounts = Array(3).fill(takerTokenFillAmount); - txHash = await contractWrappers.coordinator.batchFillOrdersAsync( - signedOrders, - takerAssetFillAmounts, - takerAddress, - ); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); +// it('should fill a batch of orders with different feeRecipientAddresses with the same coordinator server', async () => { +// const signedOrders = [signedOrder, anotherSignedOrder, signedOrderWithDifferentFeeRecipient]; +// const takerAssetFillAmounts = Array(3).fill(takerTokenFillAmount); +// txHash = await contractWrappers.coordinator.batchFillOrdersAsync( +// signedOrders, +// takerAssetFillAmounts, +// takerAddress, +// ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); - // coordinator-server, as currently implemented, shares a singleton database connection across - // all instantiations. Making the request to two different mocked server endpoints still hits the - // same database and fails because of the uniqueness constraint on transactions in the database. - it.skip('should fill a batch of orders with different feeRecipientAddresses with different coordinator servers', async () => { - const signedOrders = [ - signedOrder, - anotherSignedOrder, - signedOrderWithDifferentFeeRecipient, - signedOrderWithDifferentCoordinatorOperator, - ]; - const takerAssetFillAmounts = Array(4).fill(takerTokenFillAmount); - txHash = await contractWrappers.coordinator.batchFillOrdersAsync( - signedOrders, - takerAssetFillAmounts, - takerAddress, - ); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); +// // coordinator-server, as currently implemented, shares a singleton database connection across +// // all instantiations. Making the request to two different mocked server endpoints still hits the +// // same database and fails because of the uniqueness constraint on transactions in the database. +// it.skip('should fill a batch of orders with different feeRecipientAddresses with different coordinator servers', async () => { +// const signedOrders = [ +// signedOrder, +// anotherSignedOrder, +// signedOrderWithDifferentFeeRecipient, +// signedOrderWithDifferentCoordinatorOperator, +// ]; +// const takerAssetFillAmounts = Array(4).fill(takerTokenFillAmount); +// txHash = await contractWrappers.coordinator.batchFillOrdersAsync( +// signedOrders, +// takerAssetFillAmounts, +// takerAddress, +// ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); - it('should fill a batch of mixed coordinator and non-coordinator orders', async () => { - const nonCoordinatorOrder = await orderFactory.newSignedOrderAsync({ - senderAddress: constants.NULL_ADDRESS, - }); - const signedOrders = [signedOrder, nonCoordinatorOrder]; - const takerAssetFillAmounts = Array(2).fill(takerTokenFillAmount); - txHash = await contractWrappers.coordinator.batchFillOrdersAsync( - signedOrders, - takerAssetFillAmounts, - takerAddress, - ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); - }); - }); - describe('soft cancel order(s)', () => { - describe('#softCancelOrderAsync', () => { - it('should soft cancel a valid order', async () => { - const response = await contractWrappers.coordinator.softCancelOrderAsync(signedOrder); - expect(response.outstandingFillSignatures).to.have.lengthOf(0); - expect(response.cancellationSignatures).to.have.lengthOf(1); - }); - }); - describe('#batchSoftCancelOrdersAsync', () => { - it('should soft cancel a batch of valid orders', async () => { - const orders = [signedOrder, anotherSignedOrder]; - const response = await contractWrappers.coordinator.batchSoftCancelOrdersAsync(orders); - expect(response).to.have.lengthOf(1); - expect(response[0].outstandingFillSignatures).to.have.lengthOf(0); - expect(response[0].cancellationSignatures).to.have.lengthOf(1); - }); - it('should soft cancel a batch of orders with different feeRecipientAddresses', async () => { - const orders = [signedOrder, anotherSignedOrder, signedOrderWithDifferentFeeRecipient]; - const response = await contractWrappers.coordinator.batchSoftCancelOrdersAsync(orders); - expect(response).to.have.lengthOf(1); - expect(response[0].outstandingFillSignatures).to.have.lengthOf(0); - expect(response[0].cancellationSignatures).to.have.lengthOf(2); - }); - it('should soft cancel a batch of orders with different coordinatorOperator and concatenate responses', async () => { - const orders = [ - signedOrder, - anotherSignedOrder, - signedOrderWithDifferentFeeRecipient, - signedOrderWithDifferentCoordinatorOperator, - ]; - const response = await contractWrappers.coordinator.batchSoftCancelOrdersAsync(orders); - expect(response).to.have.lengthOf(2); - expect(response[0].outstandingFillSignatures).to.have.lengthOf(0); - expect(response[0].cancellationSignatures).to.have.lengthOf(3); - expect(response[1].cancellationSignatures).to.have.lengthOf(3); // both coordinator servers support the same feeRecipients - }); - }); - }); - describe('hard cancel order(s)', () => { - describe('#hardCancelOrderAsync', () => { - it('should hard cancel a valid order', async () => { - txHash = await contractWrappers.coordinator.hardCancelOrderAsync(signedOrder); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); - }); - describe('#batchHardCancelOrdersAsync', () => { - it('should hard cancel a batch of valid orders', async () => { - const orders = [signedOrder, anotherSignedOrder]; - txHash = await contractWrappers.coordinator.batchHardCancelOrdersAsync(orders); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - }); - }); - describe('#cancelOrdersUpTo/getOrderEpochAsync', () => { - it('should hard cancel orders up to target order epoch', async () => { - const targetOrderEpoch = new BigNumber(42); - txHash = await contractWrappers.coordinator.hardCancelOrdersUpToAsync(targetOrderEpoch, makerAddress); +// it('should fill a batch of mixed coordinator and non-coordinator orders', async () => { +// const nonCoordinatorOrder = await orderFactory.newSignedOrderAsync({ +// senderAddress: constants.NULL_ADDRESS, +// }); +// const signedOrders = [signedOrder, nonCoordinatorOrder]; +// const takerAssetFillAmounts = Array(2).fill(takerTokenFillAmount); +// txHash = await contractWrappers.coordinator.batchFillOrdersAsync( +// signedOrders, +// takerAssetFillAmounts, +// takerAddress, +// ); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); +// }); +// }); +// describe('soft cancel order(s)', () => { +// describe('#softCancelOrderAsync', () => { +// it('should soft cancel a valid order', async () => { +// const response = await contractWrappers.coordinator.softCancelOrderAsync(signedOrder); +// expect(response.outstandingFillSignatures).to.have.lengthOf(0); +// expect(response.cancellationSignatures).to.have.lengthOf(1); +// }); +// }); +// describe('#batchSoftCancelOrdersAsync', () => { +// it('should soft cancel a batch of valid orders', async () => { +// const orders = [signedOrder, anotherSignedOrder]; +// const response = await contractWrappers.coordinator.batchSoftCancelOrdersAsync(orders); +// expect(response).to.have.lengthOf(1); +// expect(response[0].outstandingFillSignatures).to.have.lengthOf(0); +// expect(response[0].cancellationSignatures).to.have.lengthOf(1); +// }); +// it('should soft cancel a batch of orders with different feeRecipientAddresses', async () => { +// const orders = [signedOrder, anotherSignedOrder, signedOrderWithDifferentFeeRecipient]; +// const response = await contractWrappers.coordinator.batchSoftCancelOrdersAsync(orders); +// expect(response).to.have.lengthOf(1); +// expect(response[0].outstandingFillSignatures).to.have.lengthOf(0); +// expect(response[0].cancellationSignatures).to.have.lengthOf(2); +// }); +// it('should soft cancel a batch of orders with different coordinatorOperator and concatenate responses', async () => { +// const orders = [ +// signedOrder, +// anotherSignedOrder, +// signedOrderWithDifferentFeeRecipient, +// signedOrderWithDifferentCoordinatorOperator, +// ]; +// const response = await contractWrappers.coordinator.batchSoftCancelOrdersAsync(orders); +// expect(response).to.have.lengthOf(2); +// expect(response[0].outstandingFillSignatures).to.have.lengthOf(0); +// expect(response[0].cancellationSignatures).to.have.lengthOf(3); +// expect(response[1].cancellationSignatures).to.have.lengthOf(3); // both coordinator servers support the same feeRecipients +// }); +// }); +// }); +// describe('hard cancel order(s)', () => { +// describe('#hardCancelOrderAsync', () => { +// it('should hard cancel a valid order', async () => { +// txHash = await contractWrappers.coordinator.hardCancelOrderAsync(signedOrder); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); +// }); +// describe('#batchHardCancelOrdersAsync', () => { +// it('should hard cancel a batch of valid orders', async () => { +// const orders = [signedOrder, anotherSignedOrder]; +// txHash = await contractWrappers.coordinator.batchHardCancelOrdersAsync(orders); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// }); +// }); +// describe('#cancelOrdersUpTo/getOrderEpochAsync', () => { +// it('should hard cancel orders up to target order epoch', async () => { +// const targetOrderEpoch = new BigNumber(42); +// txHash = await contractWrappers.coordinator.hardCancelOrdersUpToAsync(targetOrderEpoch, makerAddress); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - const orderEpoch = await contractWrappers.exchange - .orderEpoch(makerAddress, contractWrappers.coordinator.address) - .callAsync(); - expect(orderEpoch).to.be.bignumber.equal(targetOrderEpoch.plus(1)); - }); - }); - }); - describe('coordinator edge cases', () => { - it('should throw error when feeRecipientAddress is not in registry', async () => { - const badOrder = await orderFactory.newSignedOrderAsync({ - feeRecipientAddress: feeRecipientAddressFour, - }); +// await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); +// const orderEpoch = await contractWrappers.exchange +// .orderEpoch(makerAddress, contractWrappers.coordinator.address) +// .callAsync(); +// expect(orderEpoch).to.be.bignumber.equal(targetOrderEpoch.plus(1)); +// }); +// }); +// }); +// describe('coordinator edge cases', () => { +// it('should throw error when feeRecipientAddress is not in registry', async () => { +// const badOrder = await orderFactory.newSignedOrderAsync({ +// feeRecipientAddress: feeRecipientAddressFour, +// }); - expect( - contractWrappers.coordinator.fillOrderAsync(badOrder, takerTokenFillAmount, takerAddress), - ).to.be.rejected(); - }); - it('should throw error when coordinator endpoint is malformed', async () => { - await web3Wrapper.awaitTransactionSuccessAsync( - await coordinatorRegistryInstance.setCoordinatorEndpoint('localhost').sendTransactionAsync({ - from: feeRecipientAddressFour, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - expect( - contractWrappers.coordinator.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress), - ).to.be.rejected(); - }); - }); - describe('coordinator server errors', () => { - beforeEach('setup', () => { - serverValidationError = { - code: 100, - reason: 'Validation Failed', - validationErrors: [ - { - field: 'signedTransaction', - code: 1011, - reason: - 'A transaction can only be approved once. To request approval to perform the same actions, generate and sign an identical transaction with a different salt value.', - }, - ], - }; - serverCancellationSuccess = { - outstandingFillSignatures: [ - { - orderHash: '0xd1dc61f3e7e5f41d72beae7863487beea108971de678ca00d903756f842ef3ce', - approvalSignatures: [ - '0x1c7383ca8ebd6de8b5b20b1c2d49bea166df7dfe4af1932c9c52ec07334e859cf2176901da35f4480ceb3ab63d8d0339d851c31929c40d88752689b9a8a535671303', - ], - expirationTimeSeconds: 1552390380, - takerAssetFillAmount: 100000000000000000000, - }, - ], - cancellationSignatures: [ - '0x2ea3117a8ebd6de8b5b20b1c2d49bea166df7dfe4af1932c9c52ec07334e859cf2176901da35f4480ceb3ab63d8d0339d851c31929c40d88752689b9a855b5a7b401', - ], - }; - serverApprovalSuccess = { - signatures: [ - '0x1cc07d7ae39679690a91418d46491520f058e4fb14debdf2e98f2376b3970de8512ace44af0be6d1c65617f7aae8c2364ff63f241515ee1559c3eeecb0f671d9e903', - ], - expirationTimeSeconds: 1552390014, - }; +// expect( +// contractWrappers.coordinator.fillOrderAsync(badOrder, takerTokenFillAmount, takerAddress), +// ).to.be.rejected(); +// }); +// it('should throw error when coordinator endpoint is malformed', async () => { +// await web3Wrapper.awaitTransactionSuccessAsync( +// await coordinatorRegistryInstance.setCoordinatorEndpoint('localhost').sendTransactionAsync({ +// from: feeRecipientAddressFour, +// }), +// constants.AWAIT_TRANSACTION_MINED_MS, +// ); +// expect( +// contractWrappers.coordinator.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress), +// ).to.be.rejected(); +// }); +// }); +// describe('coordinator server errors', () => { +// beforeEach('setup', () => { +// serverValidationError = { +// code: 100, +// reason: 'Validation Failed', +// validationErrors: [ +// { +// field: 'signedTransaction', +// code: 1011, +// reason: +// 'A transaction can only be approved once. To request approval to perform the same actions, generate and sign an identical transaction with a different salt value.', +// }, +// ], +// }; +// serverCancellationSuccess = { +// outstandingFillSignatures: [ +// { +// orderHash: '0xd1dc61f3e7e5f41d72beae7863487beea108971de678ca00d903756f842ef3ce', +// approvalSignatures: [ +// '0x1c7383ca8ebd6de8b5b20b1c2d49bea166df7dfe4af1932c9c52ec07334e859cf2176901da35f4480ceb3ab63d8d0339d851c31929c40d88752689b9a8a535671303', +// ], +// expirationTimeSeconds: 1552390380, +// takerAssetFillAmount: 100000000000000000000, +// }, +// ], +// cancellationSignatures: [ +// '0x2ea3117a8ebd6de8b5b20b1c2d49bea166df7dfe4af1932c9c52ec07334e859cf2176901da35f4480ceb3ab63d8d0339d851c31929c40d88752689b9a855b5a7b401', +// ], +// }; +// serverApprovalSuccess = { +// signatures: [ +// '0x1cc07d7ae39679690a91418d46491520f058e4fb14debdf2e98f2376b3970de8512ace44af0be6d1c65617f7aae8c2364ff63f241515ee1559c3eeecb0f671d9e903', +// ], +// expirationTimeSeconds: 1552390014, +// }; - nock(`${coordinatorEndpoint}${coordinatorPort}`) - .post('/v1/request_transaction', () => true) - .query({ - chainId: 1337, - }) - .reply(400, serverValidationError); - }); - it('should throw error when softCancel fails', done => { - contractWrappers.coordinator - .softCancelOrderAsync(signedOrder) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.be.empty('array'); +// nock(`${coordinatorEndpoint}${coordinatorPort}`) +// .post('/v1/request_transaction', () => true) +// .query({ +// chainId: 1337, +// }) +// .reply(400, serverValidationError); +// }); +// it('should throw error when softCancel fails', done => { +// contractWrappers.coordinator +// .softCancelOrderAsync(signedOrder) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal([signedOrder]); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - done(); - }); - }); - it('should throw error when batch soft cancel fails with single coordinator operator', done => { - const orders = [signedOrder, signedOrderWithDifferentFeeRecipient]; - contractWrappers.coordinator - .batchSoftCancelOrdersAsync(orders) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.be.empty('array'); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal([signedOrder]); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// done(); +// }); +// }); +// it('should throw error when batch soft cancel fails with single coordinator operator', done => { +// const orders = [signedOrder, signedOrderWithDifferentFeeRecipient]; +// contractWrappers.coordinator +// .batchSoftCancelOrdersAsync(orders) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal(orders); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - done(); - }); - }); - it('should throw consolidated error when batch soft cancel partially fails with different coordinator operators', done => { - nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) - .post('/v1/request_transaction', () => true) - .query({ - chainId: 1337, - }) - .reply(200, serverCancellationSuccess); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal(orders); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// done(); +// }); +// }); +// it('should throw consolidated error when batch soft cancel partially fails with different coordinator operators', done => { +// nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) +// .post('/v1/request_transaction', () => true) +// .query({ +// chainId: 1337, +// }) +// .reply(200, serverCancellationSuccess); - const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; - contractWrappers.coordinator - .batchSoftCancelOrdersAsync(signedOrders) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.deep.equal([serverCancellationSuccess]); +// const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; +// contractWrappers.coordinator +// .batchSoftCancelOrdersAsync(signedOrders) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.deep.equal([serverCancellationSuccess]); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal([signedOrder]); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - done(); - }); - }); - it('should throw consolidated error when batch soft cancel totally fails with different coordinator operators', done => { - nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) - .post('/v1/request_transaction', () => true) - .query({ - chainId: 1337, - }) - .reply(400, serverValidationError); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal([signedOrder]); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// done(); +// }); +// }); +// it('should throw consolidated error when batch soft cancel totally fails with different coordinator operators', done => { +// nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) +// .post('/v1/request_transaction', () => true) +// .query({ +// chainId: 1337, +// }) +// .reply(400, serverValidationError); - const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; - contractWrappers.coordinator - .batchSoftCancelOrdersAsync(signedOrders) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.be.empty('array'); +// const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; +// contractWrappers.coordinator +// .batchSoftCancelOrdersAsync(signedOrders) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.CancellationFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal([signedOrder]); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal([signedOrder]); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - const anotherErrorBody = err.errors[1]; - expect(anotherErrorBody.isError).to.be.true(); - expect(anotherErrorBody.status).to.equal(400); - expect(anotherErrorBody.error).to.deep.equal(serverValidationError); - expect(anotherErrorBody.orders).to.deep.equal([signedOrderWithDifferentCoordinatorOperator]); - expect(anotherErrorBody.coordinatorOperator).to.equal( - `${coordinatorEndpoint}${anotherCoordinatorPort}`, - ); - done(); - }); - }); - it('should throw error when a fill fails', done => { - contractWrappers.coordinator - .fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.be.empty('array'); +// const anotherErrorBody = err.errors[1]; +// expect(anotherErrorBody.isError).to.be.true(); +// expect(anotherErrorBody.status).to.equal(400); +// expect(anotherErrorBody.error).to.deep.equal(serverValidationError); +// expect(anotherErrorBody.orders).to.deep.equal([signedOrderWithDifferentCoordinatorOperator]); +// expect(anotherErrorBody.coordinatorOperator).to.equal( +// `${coordinatorEndpoint}${anotherCoordinatorPort}`, +// ); +// done(); +// }); +// }); +// it('should throw error when a fill fails', done => { +// contractWrappers.coordinator +// .fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal([signedOrder]); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - done(); - }); - }); - it('should throw error when batch fill fails with single coordinator operator', done => { - const signedOrders = [signedOrder, signedOrderWithDifferentFeeRecipient]; - const takerAssetFillAmounts = [takerTokenFillAmount, takerTokenFillAmount, takerTokenFillAmount]; - contractWrappers.coordinator - .batchFillOrdersAsync(signedOrders, takerAssetFillAmounts, takerAddress) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.be.empty('array'); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal([signedOrder]); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// done(); +// }); +// }); +// it('should throw error when batch fill fails with single coordinator operator', done => { +// const signedOrders = [signedOrder, signedOrderWithDifferentFeeRecipient]; +// const takerAssetFillAmounts = [takerTokenFillAmount, takerTokenFillAmount, takerTokenFillAmount]; +// contractWrappers.coordinator +// .batchFillOrdersAsync(signedOrders, takerAssetFillAmounts, takerAddress) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal(signedOrders); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - done(); - }); - }); - it('should throw consolidated error when batch fill partially fails with different coordinator operators', done => { - nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) - .post('/v1/request_transaction', () => true) - .query({ - chainId: 1337, - }) - .reply(200, serverApprovalSuccess); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal(signedOrders); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// done(); +// }); +// }); +// it('should throw consolidated error when batch fill partially fails with different coordinator operators', done => { +// nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) +// .post('/v1/request_transaction', () => true) +// .query({ +// chainId: 1337, +// }) +// .reply(200, serverApprovalSuccess); - const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; - const takerAssetFillAmounts = [takerTokenFillAmount, takerTokenFillAmount, takerTokenFillAmount]; - contractWrappers.coordinator - .batchFillOrdersAsync(signedOrders, takerAssetFillAmounts, takerAddress) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); - expect(err.approvedOrders).to.deep.equal([signedOrderWithDifferentCoordinatorOperator]); - expect(err.cancellations).to.be.empty('array'); +// const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; +// const takerAssetFillAmounts = [takerTokenFillAmount, takerTokenFillAmount, takerTokenFillAmount]; +// contractWrappers.coordinator +// .batchFillOrdersAsync(signedOrders, takerAssetFillAmounts, takerAddress) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); +// expect(err.approvedOrders).to.deep.equal([signedOrderWithDifferentCoordinatorOperator]); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal([signedOrder]); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - done(); - }); - }); - it('should throw consolidated error when batch fill totally fails with different coordinator operators', done => { - nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) - .post('/v1/request_transaction', () => true) - .query({ - chainId: 1337, - }) - .reply(400, serverValidationError); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal([signedOrder]); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// done(); +// }); +// }); +// it('should throw consolidated error when batch fill totally fails with different coordinator operators', done => { +// nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`) +// .post('/v1/request_transaction', () => true) +// .query({ +// chainId: 1337, +// }) +// .reply(400, serverValidationError); - const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; - const takerAssetFillAmounts = [takerTokenFillAmount, takerTokenFillAmount, takerTokenFillAmount]; - contractWrappers.coordinator - .batchFillOrdersAsync(signedOrders, takerAssetFillAmounts, takerAddress) - .then(res => { - expect(res).to.be.undefined(); - }) - .catch(err => { - expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); - expect(err.approvedOrders).to.be.empty('array'); - expect(err.cancellations).to.be.empty('array'); +// const signedOrders = [signedOrder, signedOrderWithDifferentCoordinatorOperator]; +// const takerAssetFillAmounts = [takerTokenFillAmount, takerTokenFillAmount, takerTokenFillAmount]; +// contractWrappers.coordinator +// .batchFillOrdersAsync(signedOrders, takerAssetFillAmounts, takerAddress) +// .then(res => { +// expect(res).to.be.undefined(); +// }) +// .catch(err => { +// expect(err.message).equal(CoordinatorServerErrorMsg.FillFailed); +// expect(err.approvedOrders).to.be.empty('array'); +// expect(err.cancellations).to.be.empty('array'); - const errorBody = err.errors[0]; - expect(errorBody.isError).to.be.true(); - expect(errorBody.status).to.equal(400); - expect(errorBody.error).to.deep.equal(serverValidationError); - expect(errorBody.orders).to.deep.equal([signedOrder]); - expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); +// const errorBody = err.errors[0]; +// expect(errorBody.isError).to.be.true(); +// expect(errorBody.status).to.equal(400); +// expect(errorBody.error).to.deep.equal(serverValidationError); +// expect(errorBody.orders).to.deep.equal([signedOrder]); +// expect(errorBody.coordinatorOperator).to.equal(`${coordinatorEndpoint}${coordinatorPort}`); - const anotherErrorBody = err.errors[1]; - expect(anotherErrorBody.isError).to.be.true(); - expect(anotherErrorBody.status).to.equal(400); - expect(anotherErrorBody.error).to.deep.equal(serverValidationError); - expect(anotherErrorBody.orders).to.deep.equal([signedOrderWithDifferentCoordinatorOperator]); - expect(anotherErrorBody.coordinatorOperator).to.equal( - `${coordinatorEndpoint}${anotherCoordinatorPort}`, - ); - done(); - }); - }); - }); -}); +// const anotherErrorBody = err.errors[1]; +// expect(anotherErrorBody.isError).to.be.true(); +// expect(anotherErrorBody.status).to.equal(400); +// expect(anotherErrorBody.error).to.deep.equal(serverValidationError); +// expect(anotherErrorBody.orders).to.deep.equal([signedOrderWithDifferentCoordinatorOperator]); +// expect(anotherErrorBody.coordinatorOperator).to.equal( +// `${coordinatorEndpoint}${anotherCoordinatorPort}`, +// ); +// done(); +// }); +// }); +// }); +// }); // tslint:disable:max-file-line-count diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 88a78dcb3f..0a2113d4d8 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -1,4 +1,3 @@ -import { CoordinatorContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; import * as artifacts from '@0x/contract-artifacts'; import { @@ -9,7 +8,7 @@ import { MultiAssetProxyContract, StaticCallProxyContract, } from '@0x/contracts-asset-proxy'; -import { CoordinatorRegistryContract } from '@0x/contracts-coordinator'; +import { CoordinatorContract, CoordinatorRegistryContract } from '@0x/contracts-coordinator'; import { DevUtilsContract } from '@0x/contracts-dev-utils'; import { ERC1155MintableContract } from '@0x/contracts-erc1155'; import { DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20'; @@ -209,6 +208,7 @@ export async function runMigrationsAsync( txDefaults, artifacts, exchange.address, + chainId, ); // Dev Utils