From 43072ef80d2ab066adfdb19ef756a7f2ff760ab6 Mon Sep 17 00:00:00 2001 From: Brandon Chow Date: Mon, 15 Jul 2019 18:33:33 -0700 Subject: [PATCH 01/18] Add test for checksummed addresses being valid inputs for tx origin when calling signTransactionAsync in the private key subprovider --- packages/subproviders/CHANGELOG.json | 10 ++++++++++ .../test/unit/private_key_wallet_subprovider_test.ts | 5 +++++ packages/subproviders/test/utils/fixture_data.ts | 2 ++ 3 files changed, 17 insertions(+) diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index aff03d19dc..1d569b4b50 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "4.1.2", + "changes": [ + { + "note": "Fix bug in Trezor subprovider causing Trezor response to not be hex encoded", + "pr": "WIP" + } + ], + "timestamp": 1563240294 + }, { "version": "4.1.1", "changes": [ diff --git a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts index 2bb45e48bc..1a9cdd6bda 100644 --- a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts @@ -33,6 +33,11 @@ describe('PrivateKeyWalletSubprovider', () => { const txHex = await subprovider.signTransactionAsync(fixtureData.TX_DATA); expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT); }); + it('signs a transaction where the tx.origin is checksummed.', async () => { + const TX_DATA_CHECKSUMMED_ORIGIN = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_0_CHECKSUMMED }; + const txHex = await subprovider.signTransactionAsync(TX_DATA_CHECKSUMMED_ORIGIN); + expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT); + }); it('signs an EIP712 sign typed data message', async () => { const signature = await subprovider.signTypedDataAsync( fixtureData.TEST_RPC_ACCOUNT_0, diff --git a/packages/subproviders/test/utils/fixture_data.ts b/packages/subproviders/test/utils/fixture_data.ts index 3eb4493b5d..d23fb73a77 100644 --- a/packages/subproviders/test/utils/fixture_data.ts +++ b/packages/subproviders/test/utils/fixture_data.ts @@ -1,10 +1,12 @@ const TEST_RPC_ACCOUNT_0 = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; +const TEST_RPC_ACCOUNT_0_CHECKSUMMED = '0x5409ED021D9299bf6814279A6A1411A7e866A631'; const TEST_RPC_ACCOUNT_1 = '0x6ecbe1db9ef729cbe972c83fb886247691fb6beb'; const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; const networkId = 42; export const fixtureData = { NULL_ADDRESS, TEST_RPC_ACCOUNT_0, + TEST_RPC_ACCOUNT_0_CHECKSUMMED, TEST_RPC_ACCOUNT_0_ACCOUNT_PRIVATE_KEY: 'F2F48EE19680706196E2E339E5DA3491186E0C4C5030670656B0E0164837257D', TEST_RPC_ACCOUNT_1, TEST_RPC_MNEMONIC: 'concert load couple harbor equip island argue ramp clarify fence smart topic', From 6e0f982163f445a8c921ec396c6d626591b457cf Mon Sep 17 00:00:00 2001 From: Brandon Chow Date: Mon, 15 Jul 2019 18:34:32 -0700 Subject: [PATCH 02/18] Downcase addresses when checking for address equality in signTransactionAsync in the private key subprovider --- packages/subproviders/CHANGELOG.json | 4 ++-- packages/subproviders/src/subproviders/private_key_wallet.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 1d569b4b50..283989fa0a 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -3,8 +3,8 @@ "version": "4.1.2", "changes": [ { - "note": "Fix bug in Trezor subprovider causing Trezor response to not be hex encoded", - "pr": "WIP" + "note": "Fix bug in Private Key subprovider causing checksummed tx.origin addresses to be rejected.", + "pr": 1962 } ], "timestamp": 1563240294 diff --git a/packages/subproviders/src/subproviders/private_key_wallet.ts b/packages/subproviders/src/subproviders/private_key_wallet.ts index 98bc8963eb..67693ac44d 100644 --- a/packages/subproviders/src/subproviders/private_key_wallet.ts +++ b/packages/subproviders/src/subproviders/private_key_wallet.ts @@ -47,7 +47,7 @@ export class PrivateKeyWalletSubprovider extends BaseWalletSubprovider { */ public async signTransactionAsync(txParams: PartialTxParams): Promise { PrivateKeyWalletSubprovider._validateTxParams(txParams); - if (txParams.from !== undefined && txParams.from !== this._address) { + if (txParams.from !== undefined && txParams.from.toLowerCase() !== this._address.toLowerCase()) { throw new Error( `Requested to sign transaction with address: ${txParams.from}, instantiated with address: ${ this._address From 54f4727adc6da95f312e3721f44857110555d24c Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 15 Jul 2019 22:07:15 -0700 Subject: [PATCH 03/18] Implement StaticCallProxy in Solidity --- .../contracts/src/StaticCallProxy.sol | 208 ++++-------------- 1 file changed, 42 insertions(+), 166 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol index 9b1a7a92ef..c8b12faea6 100644 --- a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol +++ b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol @@ -18,181 +18,57 @@ pragma solidity ^0.5.9; +import "@0x/contracts-utils/contracts/src/LibBytes.sol"; + +// solhint-disable no-unused-vars contract StaticCallProxy { + using LibBytes for bytes; + // Id of this proxy. bytes4 constant internal PROXY_ID = bytes4(keccak256("StaticCall(address,bytes,bytes32)")); - // solhint-disable-next-line payable-fallback - function () + /// @dev Makes a staticcall to a target address and verifies that the data returned matches the expected return data. + /// @param assetData Byte array encoded with staticCallTarget, staticCallData, and expectedCallResultHash + /// @param from This value is ignored. + /// @param to This value is ignored. + /// @param amount This value is ignored. + function transferFrom( + bytes calldata assetData, + address from, + address to, + uint256 amount + ) external + view { - assembly { - // The first 4 bytes of calldata holds the function selector - let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) - - // `transferFrom` will be called with the following parameters: - // assetData Encoded byte array. - // from Address to transfer asset from. - // to Address to transfer asset to. - // amount Amount of asset to transfer. - // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4 - if eq(selector, 0xa85e59e400000000000000000000000000000000000000000000000000000000) { - - // `transferFrom`. - // The function is marked `external`, so no abi decoding is done for - // us. Instead, we expect the `calldata` memory to contain the - // following: - // - // | Area | Offset | Length | Contents | - // |----------|--------|---------|-------------------------------------| - // | Header | 0 | 4 | function selector | - // | Params | | 4 * 32 | function parameters: | - // | | 4 | | 1. offset to assetData (*) | - // | | 36 | | 2. from | - // | | 68 | | 3. to | - // | | 100 | | 4. amount | - // | Data | | | assetData: | - // | | 132 | 32 | assetData Length | - // | | 164 | ** | assetData Contents | - // - // (*): offset is computed from start of function parameters, so offset - // by an additional 4 bytes in the calldata. - // - // (**): see table below to compute length of assetData Contents - // (***): Note that the `from`, `to`, and `amount` params in calldata are ignored in this function. - // - // WARNING: The ABIv2 specification allows additional padding between - // the Params and Data section. This will result in a larger - // offset to assetData. - - // Load offset to `assetData` - let assetDataOffset := add(calldataload(4), 4) - - // Validate length of `assetData` - let assetDataLen := calldataload(assetDataOffset) - if or(lt(assetDataLen, 100), mod(sub(assetDataLen, 4), 32)) { - // Revert with `Error("INVALID_ASSET_DATA_LENGTH")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000019494e56414c49445f41535345545f444154415f4c454e475448000000) - mstore(96, 0) - revert(0, 100) - } - - // Ensure that `assetData` ends inside of calldata - let assetDataEnd := add(assetDataOffset, add(assetDataLen, 32)) - if gt(assetDataEnd, calldatasize()) { - // Revert with `Error("INVALID_ASSET_DATA_END")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000016494e56414c49445f41535345545f444154415f454e44000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Asset data is encoded as follows: - // | Area | Offset | Length | Contents | - // |----------|-------------|---------|--------------------------------------| - // | Header | 0 | 4 | assetProxyId | - // | Params | | 4 * 32 | function parameters: | - // | | 4 | | 1. address of callTarget | - // | | 36 | | 2. offset to staticCallData (*) | - // | | 68 | | 3. expected 32 byte hash of output | - // | Data | | | staticCallData: | - // | | 100 | 32 | 1. staticCallData Length | - // | | 132 | a | 2. staticCallData Contents | - - // In order to find the offset to `staticCallData`, we must add: - // assetDataOffset - // + 32 (assetData len) - // + 4 (proxyId) - // + 32 (callTarget) - let paramsInAssetDataOffset := add(assetDataOffset, 36) - let staticCallDataOffset := add(paramsInAssetDataOffset, calldataload(add(assetDataOffset, 68))) - - // Load length of `staticCallData` - let staticCallDataLen := calldataload(staticCallDataOffset) - - // Ensure `staticCallData` does not begin to outside of `assetData` - let staticCallDataBegin := add(staticCallDataOffset, 32) - let staticCallDataEnd := add(staticCallDataBegin, staticCallDataLen) - if gt(staticCallDataEnd, assetDataEnd) { - // Revert with `Error("INVALID_STATIC_CALL_DATA_OFFSET")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x0000001f494e56414c49445f5354415449435f43414c4c5f444154415f4f4646) - mstore(96, 0x5345540000000000000000000000000000000000000000000000000000000000) - revert(0, 100) - } - - // Copy `staticCallData` into memory - calldatacopy( - 0, // memory can be safely overwritten from beginning - staticCallDataBegin, // start of `staticCallData` - staticCallDataLen // copy the entire `staticCallData` - ) - - // In order to find the offset to `callTarget`, we must add: - // assetDataOffset - // + 32 (assetData len) - // + 4 (proxyId) - let callTarget := and( - calldataload(add(assetDataOffset, 36)), - 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff - ) - - // Perform `callTarget.staticcall(staticCallData)` - let success := staticcall( - gas, // forward all gas - callTarget, // call address `callTarget` - 0, // pointer to start of input - staticCallDataLen, // length of input - 0, // start of memory can be safely overwritten - 0 // don't copy output to memory - ) - - // Copy entire output to start of memory - let outputLen := returndatasize() - returndatacopy( - 0, // copy to memory at 0 - 0, // copy from return data at 0 - outputLen // copy all return data - ) - - // Revert with reason given by `callTarget` if staticcall is unsuccessful - if iszero(success) { - revert(0, outputLen) - } - - // Calculate hash of output - let callResultHash := keccak256(0, outputLen) - - // In order to find the offset to `expectedCallResultHash`, we must add: - // assetDataOffset - // + 32 (assetData len) - // + 4 (proxyId) - // + 32 (callTarget) - // + 32 (staticCallDataOffset) - let expectedResultHash := calldataload(add(assetDataOffset, 100)) - - if sub(callResultHash, expectedResultHash) { - // Revert with `Error("UNEXPECTED_STATIC_CALL_RESULT")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x0000001d554e45585045435445445f5354415449435f43414c4c5f524553554c) - mstore(96, 0x5400000000000000000000000000000000000000000000000000000000000000) - revert(0, 100) - } - - // Return if output matched expected output - return(0, 0) + // Decode params from `assetData` + ( + address staticCallTarget, + bytes memory staticCallData, + bytes32 expectedReturnDataHash + ) = abi.decode( + assetData.sliceDestructive(4, assetData.length), + (address, bytes, bytes32) + ); + + // Execute staticcall + (bool success, bytes memory returnData) = staticCallTarget.staticcall(staticCallData); + + // Revert with returned data if staticcall is unsuccessful + if (!success) { + assembly { + revert(add(returnData, 32), mload(returnData)) } - - // Revert if undefined function is called - revert(0, 0) } + + // Revert if hash of return data is not as expected + bytes32 returnDataHash = keccak256(returnData); + require( + expectedReturnDataHash == returnDataHash, + "UNEXPECTED_STATIC_CALL_RESULT" + ); } /// @dev Gets the proxy id associated with the proxy address. @@ -204,4 +80,4 @@ contract StaticCallProxy { { return PROXY_ID; } -} \ No newline at end of file +} From 185e2342d97dc372c72ab2642c7fb00ee92f7902 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 15 Jul 2019 22:07:31 -0700 Subject: [PATCH 04/18] Update StaticCallProxy tests --- .../asset-proxy/test/static_call_proxy.ts | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/contracts/asset-proxy/test/static_call_proxy.ts b/contracts/asset-proxy/test/static_call_proxy.ts index 52cb50e2c5..55db645fb2 100644 --- a/contracts/asset-proxy/test/static_call_proxy.ts +++ b/contracts/asset-proxy/test/static_call_proxy.ts @@ -95,26 +95,12 @@ describe('StaticCallProxy', () => { const invalidOffsetToAssetData = ethUtil.bufferToHex(paddedTxDataEndBuffer).slice(2); const newAssetData = '0000000000000000000000000000000000000000000000000000000000000304'; const badTxData = `${txData.replace(offsetToAssetData, invalidOffsetToAssetData)}${newAssetData}`; - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( web3Wrapper.sendTransactionAsync({ to: staticCallProxy.address, from: fromAddress, data: badTxData, }), - RevertReason.InvalidAssetDataEnd, - ); - }); - it('should revert if the length of assetData, excluding the proxyId, is not a multiple of 32', async () => { - const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData(); - const expectedResultHash = constants.KECCAK256_NULL; - const assetData = `${assetDataUtils.encodeStaticCallAssetData( - staticCallTarget.address, - staticCallData, - expectedResultHash, - )}01`; - await expectTransactionFailedAsync( - staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), - RevertReason.InvalidAssetDataLength, ); }); it('should revert if the length of assetData is less than 100 bytes', async () => { @@ -125,9 +111,8 @@ describe('StaticCallProxy', () => { .slice(0, -128); const assetDataByteLen = (assetData.length - 2) / 2; expect((assetDataByteLen - 4) % 32).to.equal(0); - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), - RevertReason.InvalidAssetDataLength, ); }); it('should revert if the offset to `staticCallData` points to outside of assetData', async () => { @@ -147,9 +132,8 @@ describe('StaticCallProxy', () => { offsetToStaticCallData, invalidOffsetToStaticCallData, )}${newStaticCallData}`; - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( staticCallProxy.transferFrom.sendTransactionAsync(badAssetData, fromAddress, toAddress, amount), - RevertReason.InvalidStaticCallDataOffset, ); }); it('should revert if the callTarget attempts to write to state', async () => { From 77484dc69eea1f4f1a8397590199f3f2489751d2 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 15 Jul 2019 22:08:08 -0700 Subject: [PATCH 05/18] Implement ERC1155Proxy in Solidity --- .../contracts/src/ERC1155Proxy.sol | 384 +++--------------- .../contracts/src/interfaces/IAssetProxy.sol | 5 +- 2 files changed, 55 insertions(+), 334 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol b/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol index e1a17ff2b1..3489359500 100644 --- a/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol +++ b/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol @@ -18,349 +18,71 @@ pragma solidity ^0.5.9; +import "@0x/contracts-utils/contracts/src/LibBytes.sol"; +import "@0x/contracts-utils/contracts/src/SafeMath.sol"; +import "@0x/contracts-erc1155/contracts/src/interfaces/IERC1155.sol"; import "./MixinAuthorizable.sol"; +import "./interfaces/IAssetProxy.sol"; contract ERC1155Proxy is - MixinAuthorizable + MixinAuthorizable, + SafeMath, + IAssetProxy { + using LibBytes for bytes; // Id of this proxy. bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC1155Assets(address,uint256[],uint256[],bytes)")); - // solhint-disable-next-line payable-fallback - function () + /// @dev Transfers batch of ERC1155 assets. Either succeeds or throws. + /// @param assetData Byte array encoded with ERC1155 token address, array of ids, array of values, and callback data. + /// @param from Address to transfer assets from. + /// @param to Address to transfer assets to. + /// @param amount Amount that will be multiplied with each element of `assetData.values` to scale the + /// values that will be transferred. + function transferFrom( + bytes calldata assetData, + address from, + address to, + uint256 amount + ) external + onlyAuthorized { - // Input calldata to this function is encoded as follows: - // -- TABLE #1 -- - // | Area | Offset (**) | Length | Contents | - // |----------|-------------|-------------|---------------------------------| - // | Header | 0 | 4 | function selector | - // | Params | | 4 * 32 | function parameters: | - // | | 4 | | 1. offset to assetData (*) | - // | | 36 | | 2. from | - // | | 68 | | 3. to | - // | | 100 | | 4. amount | - // | Data | | | assetData: | - // | | 132 | 32 | assetData Length | - // | | 164 | (see below) | assetData Contents | - // - // - // Asset data is encoded as follows: - // -- TABLE #2 -- - // | Area | Offset | Length | Contents | - // |----------|-------------|---------|-------------------------------------| - // | Header | 0 | 4 | assetProxyId | - // | Params | | 4 * 32 | function parameters: | - // | | 4 | | 1. address of ERC1155 contract | - // | | 36 | | 2. offset to ids (*) | - // | | 68 | | 3. offset to values (*) | - // | | 100 | | 4. offset to data (*) | - // | Data | | | ids: | - // | | 132 | 32 | 1. ids Length | - // | | 164 | a | 2. ids Contents | - // | | | | values: | - // | | 164 + a | 32 | 1. values Length | - // | | 196 + a | b | 2. values Contents | - // | | | | data: | - // | | 196 + a + b | 32 | 1. data Length | - // | | 228 + a + b | c | 2. data Contents | - // - // - // Calldata for target ERC155 asset is encoded for safeBatchTransferFrom: - // -- TABLE #3 -- - // | Area | Offset (**) | Length | Contents | - // |----------|-------------|---------|-------------------------------------| - // | Header | 0 | 4 | safeBatchTransferFrom selector | - // | Params | | 5 * 32 | function parameters: | - // | | 4 | | 1. from address | - // | | 36 | | 2. to address | - // | | 68 | | 3. offset to ids (*) | - // | | 100 | | 4. offset to values (*) | - // | | 132 | | 5. offset to data (*) | - // | Data | | | ids: | - // | | 164 | 32 | 1. ids Length | - // | | 196 | a | 2. ids Contents | - // | | | | values: | - // | | 196 + a | 32 | 1. values Length | - // | | 228 + a | b | 2. values Contents | - // | | | | data: | - // | | 228 + a + b | 32 | 1. data Length | - // | | 260 + a + b | c | 2. data Contents | - // - // - // (*): offset is computed from start of function parameters, so offset - // by an additional 4 bytes in the calldata. - // - // (**): the `Offset` column is computed assuming no calldata compression; - // offsets in the Data Area are dynamic and should be evaluated in - // real-time. - // - // WARNING: The ABIv2 specification allows additional padding between - // the Params and Data section. This will result in a larger - // offset to assetData. - // - // Note: Table #1 and Table #2 exist in Calldata. We construct Table #3 in memory. - // - // - assembly { - // The first 4 bytes of calldata holds the function selector - let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) - - // `transferFrom` will be called with the following parameters: - // assetData Encoded byte array. - // from Address to transfer asset from. - // to Address to transfer asset to. - // amount Amount of asset to transfer. - // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4 - if eq(selector, 0xa85e59e400000000000000000000000000000000000000000000000000000000) { - - // To lookup a value in a mapping, we load from the storage location keccak256(k, p), - // where k is the key left padded to 32 bytes and p is the storage slot - mstore(0, caller) - mstore(32, authorized_slot) - - // Revert if authorized[msg.sender] == false - if iszero(sload(keccak256(0, 64))) { - // Revert with `Error("SENDER_NOT_AUTHORIZED")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x0000001553454e4445525f4e4f545f415554484f52495a454400000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Construct Table #3 in memory, starting at memory offset 0. - // The algorithm below maps calldata (Table #1) and assetData (Table #2) to memory (Table #3). - // Once Table #3 ha been constructed in memory, the destination erc1155 contract is called using this - // as its calldata. This process is divided into three steps, below. - - ////////// STEP 1/3 - Map calldata to memory (Table #1 -> Table #3) ////////// - - // Store the safeBatchTransferFrom function selector, which is computed using: - // bytes4(keccak256("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)")) - mstore(0, 0x2eb2c2d600000000000000000000000000000000000000000000000000000000) - - // Copy `from` and `to` fields from calldata (Table #1) into memory (Table #3) - calldatacopy( - 4, // aligned such that `from` and `to` are at the correct location for Table #3 - 36, // beginning of `from` field from Table #1 - 64 // 32 bytes for `from` + 32 bytes for `to` field - ) - - ////////// STEP 2/3 - Map assetData to memory (Table #2 -> Table #3) ////////// - - // Map relevant fields from assetData (Table #2) into memory (Table #3) - // The Contents column of Table #2 is the same as Table #3, - // beginning from parameter 3 - `offset to ids (*)` - // The `values` from assetData (Table #2) are multiplied by `amount` (Table #1) - // when they are copied into memory. - - // Load offset to `assetData` - let assetDataOffset := add(calldataload(4), 4) - - // Load length in bytes of `assetData` - let assetDataLength := calldataload(assetDataOffset) - - // Assert that the length of asset data: - // 1. Must be at least 132 bytes (Table #2) - // 2. Must be a multiple of 32 (excluding the 4-byte selector) - if or(lt(assetDataLength, 132), mod(sub(assetDataLength, 4), 32)) { - // Revert with `Error("INVALID_ASSET_DATA_LENGTH")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000019494e56414c49445f41535345545f444154415f4c454e475448000000) - mstore(96, 0) - revert(0, 100) - } - - // End of asset data in calldata - // +32 for length field - let assetDataEnd := add(assetDataOffset, add(assetDataLength, 32)) - if gt(assetDataEnd, calldatasize()) { - // Revert with `Error("INVALID_ASSET_DATA_END")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000016494e56414c49445f41535345545f444154415f454e44000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Load offset to parameters section in asset data - let paramsInAssetDataOffset := add(assetDataOffset, 36) - - // Offset of end of Data Area in memory. - // This value will grow as we construct Table #3. - let dataAreaEndOffset := 164 - - // Load amount by which to scale values - let amount := calldataload(100) - - // Store pointer to `ids` (Table #3) - // Subtract 4 for `safeBatchTransferFrom` selector - mstore(68, sub(dataAreaEndOffset, 4)) - - // Ensure length of `ids` does not overflow - let idsOffset := add(paramsInAssetDataOffset, calldataload(add(assetDataOffset, 68))) - let idsLength := calldataload(idsOffset) - let idsLengthInBytes := mul(idsLength, 32) - if sub(div(idsLengthInBytes, 32), idsLength) { - // Revert with `Error("UINT256_OVERFLOW")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x0000001055494e543235365f4f564552464c4f57000000000000000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Ensure `ids` does not resolve to outside of `assetData` - let idsBegin := add(idsOffset, 32) - let idsEnd := add(idsBegin, idsLengthInBytes) - if gt(idsEnd, assetDataEnd) { - // Revert with `Error("INVALID_IDS_OFFSET")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000012494e56414c49445f4944535f4f464653455400000000000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Copy `ids` from `assetData` (Table #2) to memory (Table #3) - calldatacopy( - dataAreaEndOffset, - idsOffset, - add(idsLengthInBytes, 32) - ) - dataAreaEndOffset := add(dataAreaEndOffset, add(idsLengthInBytes, 32)) - - // Store pointer to `values` (Table #3) - // Subtract 4 for `safeBatchTrasferFrom` selector - mstore(100, sub(dataAreaEndOffset, 4)) - - // Ensure length of `values` does not overflow - let valuesOffset := add(paramsInAssetDataOffset, calldataload(add(assetDataOffset, 100))) - let valuesLength := calldataload(valuesOffset) - let valuesLengthInBytes := mul(valuesLength, 32) - if sub(div(valuesLengthInBytes, 32), valuesLength) { - // Revert with `Error("UINT256_OVERFLOW")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x0000001055494e543235365f4f564552464c4f57000000000000000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Ensure `values` does not resolve to outside of `assetData` - let valuesBegin := add(valuesOffset, 32) - let valuesEnd := add(valuesBegin, valuesLengthInBytes) - if gt(valuesEnd, assetDataEnd) { - // Revert with `Error("INVALID_VALUES_OFFSET")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000015494e56414c49445f56414c5545535f4f464653455400000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Store length of `values` - mstore(dataAreaEndOffset, valuesLength) - dataAreaEndOffset := add(dataAreaEndOffset, 32) - - // Scale and store elements of `values` - for { let currentValueOffset := valuesBegin } - lt(currentValueOffset, valuesEnd) - { currentValueOffset := add(currentValueOffset, 32) } - { - // Load value and generate scaled value - let currentValue := calldataload(currentValueOffset) - let currentValueScaled := mul(currentValue, amount) - - // Revert if `amount` != 0 and multiplication resulted in an overflow - if iszero(or( - iszero(amount), - eq(div(currentValueScaled, amount), currentValue) - )) { - // Revert with `Error("UINT256_OVERFLOW")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x0000001055494e543235365f4f564552464c4f57000000000000000000000000) - mstore(96, 0) - revert(0, 100) - } - - // There was no overflow, store the scaled token value - mstore(dataAreaEndOffset, currentValueScaled) - dataAreaEndOffset := add(dataAreaEndOffset, 32) - } - - // Store pointer to `data` (Table #3) - // Subtract 4 for `safeBatchTrasferFrom` selector - mstore(132, sub(dataAreaEndOffset, 4)) - - // Ensure `data` does not resolve to outside of `assetData` - let dataOffset := add(paramsInAssetDataOffset, calldataload(add(assetDataOffset, 132))) - let dataLengthInBytes := calldataload(dataOffset) - let dataBegin := add(dataOffset, 32) - let dataEnd := add(dataBegin, dataLengthInBytes) - if gt(dataEnd, assetDataEnd) { - // Revert with `Error("INVALID_DATA_OFFSET")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) - mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000013494e56414c49445f444154415f4f4646534554000000000000000000) - mstore(96, 0) - revert(0, 100) - } - - // Copy `data` from `assetData` (Table #2) to memory (Table #3) - calldatacopy( - dataAreaEndOffset, - dataOffset, - add(dataLengthInBytes, 32) - ) - - // Update the end of data offset to be word-aligned - let dataLengthInWords := div(add(dataLengthInBytes, 31), 32) - let dataLengthInBytesWordAligned := mul(dataLengthInWords, 32) - dataAreaEndOffset := add(dataAreaEndOffset, add(dataLengthInBytesWordAligned, 32)) - - ////////// STEP 3/3 - Execute Transfer ////////// - // Load the address of the destination erc1155 contract from asset data (Table #2) - // +32 bytes for assetData Length - // +4 bytes for assetProxyId - let assetAddress := and( - calldataload(add(assetDataOffset, 36)), - 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff - ) - - // Call into the destination erc1155 contract using as calldata Table #3 (constructed in-memory above) - let success := call( - gas, // forward all gas - assetAddress, // call address of erc1155 asset - 0, // don't send any ETH - 0, // pointer to start of input - dataAreaEndOffset, // length of input is the end of the Data Area (Table #3) - 0, // write output over memory that won't be reused - 0 // don't copy output to memory - ) - - // Revert with reason given by AssetProxy if `transferFrom` call failed - if iszero(success) { - returndatacopy( - 0, // copy to memory at 0 - 0, // copy from return data at 0 - returndatasize() // copy all return data - ) - revert(0, returndatasize()) - } - - // Return if call was successful - return(0, 0) - } - - // Revert if undefined function is called - revert(0, 0) + // Decode params from `assetData` + // solhint-disable indent + ( + address erc1155TokenAddress, + uint256[] memory ids, + uint256[] memory values, + bytes memory data + ) = abi.decode( + assetData.sliceDestructive(4, assetData.length), + (address, uint256[], uint256[], bytes) + ); + // solhint-enable indent + + // Scale values up by `amount` + uint256 length = values.length; + uint256[] memory scaledValues = new uint256[](length); + for (uint256 i = 0; i != length; i++) { + // We write the scaled values to an unused location in memory in order + // to avoid copying over `ids` or `data`. This is possible if they are + // identical to `values` and the offsets for each are pointing to the + // same location in the ABI encoded calldata. + scaledValues[i] = safeMul(values[i], amount); } + + // Execute `safeBatchTransferFrom` call + // Either succeeds or throws + IERC1155(erc1155TokenAddress).safeBatchTransferFrom( + from, + to, + ids, + scaledValues, + data + ); } /// @dev Gets the proxy id associated with the proxy address. diff --git a/contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol b/contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol index d176b57ade..cbf03bc775 100644 --- a/contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol +++ b/contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol @@ -21,9 +21,8 @@ pragma solidity ^0.5.5; import "./IAuthorizable.sol"; -contract IAssetProxy is - IAuthorizable -{ +contract IAssetProxy { + /// @dev Transfers assets. Either succeeds or throws. /// @param assetData Byte array encoded for the respective asset proxy. /// @param from Address to transfer asset from. From 10d767c5ab31901e7369c5d7a312c91b7b8fd149 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 15 Jul 2019 22:08:23 -0700 Subject: [PATCH 06/18] Update ERC1155Proxy tests --- contracts/asset-proxy/test/erc1155_proxy.ts | 84 ++++++--------------- 1 file changed, 21 insertions(+), 63 deletions(-) diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 1b0808d115..fef6e7074f 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -1077,7 +1077,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token ids to point outside the calldata. + // We want to change the offset to token ids to point outside the calldata. const encodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000080'; const badEncodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000180'; const assetDataWithBadTokenIdsOffset = assetData.replace( @@ -1085,7 +1085,7 @@ describe('ERC1155Proxy', () => { badEncodedOffsetToTokenIds, ); // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1097,7 +1097,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithBadTokenIdsOffset, ), - RevertReason.InvalidIdsOffset, ); }); it('should revert if an element of token ids lies to outside the bounds of calldata', async () => { @@ -1125,7 +1124,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token ids to the end of calldata. + // We want to change the offset to token ids to the end of calldata. // Then we'll add an invalid length: we encode length of 2 but only add 1 element. const encodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000080'; const newEcodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000140'; @@ -1137,7 +1136,7 @@ describe('ERC1155Proxy', () => { const encodedTokenIdValues = '0000000000000000000000000000000000000000000000000000000000000001'; const assetDataWithBadTokenIds = `${assetDataWithNewTokenIdsOffset}${encodedTokenIdsLength}${encodedTokenIdValues}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1149,7 +1148,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithBadTokenIds, ), - RevertReason.InvalidIdsOffset, ); }); it('should revert token ids length overflows', async () => { @@ -1177,7 +1175,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token ids to point to the end of calldata + // We want to change the offset to token ids to point to the end of calldata const encodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000080'; const badEncodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000140'; const assetDataWithBadTokenIdsOffset = assetData.replace( @@ -1189,7 +1187,7 @@ describe('ERC1155Proxy', () => { const buffer = '0'.repeat(64 * 10); const assetDataWithOverflow = `${assetDataWithBadTokenIdsOffset}${encodedIdsLengthOverflow}${buffer}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1201,7 +1199,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithOverflow, ), - RevertReason.Uint256Overflow, ); }); it('should revert token values length overflows', async () => { @@ -1229,7 +1226,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token values to point to the end of calldata + // We want to change the offset to token values to point to the end of calldata const encodedOffsetToTokenIds = '00000000000000000000000000000000000000000000000000000000000000c0'; const badEncodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000140'; const assetDataWithBadTokenIdsOffset = assetData.replace( @@ -1241,7 +1238,7 @@ describe('ERC1155Proxy', () => { const buffer = '0'.repeat(64 * 10); const assetDataWithOverflow = `${assetDataWithBadTokenIdsOffset}${encodedIdsLengthOverflow}${buffer}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1253,7 +1250,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithOverflow, ), - RevertReason.Uint256Overflow, ); }); it('should revert token data length overflows', async () => { @@ -1281,7 +1277,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token ids to point to the end of calldata, + // We want to change the offset to token ids to point to the end of calldata, // which we'll extend with a bad length. const encodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000100'; const badEncodedOffsetToTokenIds = '0000000000000000000000000000000000000000000000000000000000000140'; @@ -1294,7 +1290,7 @@ describe('ERC1155Proxy', () => { const buffer = '0'.repeat(64 * 10); const assetDataWithOverflow = `${assetDataWithBadTokenIdsOffset}${encodedIdsLengthOverflow}${buffer}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1306,7 +1302,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithOverflow, ), - RevertReason.InvalidDataOffset, ); }); it('should revert if token values resolves to outside the bounds of calldata', async () => { @@ -1334,7 +1329,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token values to point outside the calldata. + // We want to change the offset to token values to point outside the calldata. const encodedOffsetToTokenValues = '00000000000000000000000000000000000000000000000000000000000000c0'; const badEncodedOffsetToTokenValues = '00000000000000000000000000000000000000000000000000000000000001c0'; const assetDataWithBadTokenIdsOffset = assetData.replace( @@ -1342,7 +1337,7 @@ describe('ERC1155Proxy', () => { badEncodedOffsetToTokenValues, ); // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1354,7 +1349,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithBadTokenIdsOffset, ), - RevertReason.InvalidValuesOffset, ); }); it('should revert if an element of token values lies to outside the bounds of calldata', async () => { @@ -1382,7 +1376,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token values to the end of calldata. + // We want to change the offset to token values to the end of calldata. // Then we'll add an invalid length: we encode length of 2 but only add 1 element. const encodedOffsetToTokenValues = '00000000000000000000000000000000000000000000000000000000000000c0'; const newEcodedOffsetToTokenValues = '0000000000000000000000000000000000000000000000000000000000000140'; @@ -1394,7 +1388,7 @@ describe('ERC1155Proxy', () => { const encodedTokenValuesElements = '0000000000000000000000000000000000000000000000000000000000000001'; const assetDataWithBadTokenIds = `${assetDataWithNewTokenValuesOffset}${encodedTokenValuesLength}${encodedTokenValuesElements}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1406,7 +1400,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithBadTokenIds, ), - RevertReason.InvalidValuesOffset, ); }); it('should revert if token data resolves to outside the bounds of calldata', async () => { @@ -1434,7 +1427,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token data to point outside the calldata. + // We want to change the offset to token data to point outside the calldata. const encodedOffsetToTokenData = '0000000000000000000000000000000000000000000000000000000000000100'; const badEncodedOffsetToTokenData = '00000000000000000000000000000000000000000000000000000000000001c0'; const assetDataWithBadTokenDataOffset = assetData.replace( @@ -1442,7 +1435,7 @@ describe('ERC1155Proxy', () => { badEncodedOffsetToTokenData, ); // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1454,7 +1447,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithBadTokenDataOffset, ), - RevertReason.InvalidDataOffset, ); }); it('should revert if an element of token data lies to outside the bounds of calldata', async () => { @@ -1482,7 +1474,7 @@ describe('ERC1155Proxy', () => { // 0x100 0000000000000000000000000000000000000000000000000000000000000004 // 0x120 0102030400000000000000000000000000000000000000000000000000000000 // - // We want to chan ge the offset to token data to the end of calldata. + // We want to change the offset to token data to the end of calldata. // Then we'll add an invalid length: we encode length of 33 but only add 32 elements. const encodedOffsetToTokenData = '0000000000000000000000000000000000000000000000000000000000000100'; const newEcodedOffsetToTokenData = '0000000000000000000000000000000000000000000000000000000000000140'; @@ -1494,7 +1486,7 @@ describe('ERC1155Proxy', () => { const encodedTokenDataElements = '0000000000000000000000000000000000000000000000000000000000000001'; const assetDataWithBadTokenData = `${assetDataWithNewTokenDataOffset}${encodedTokenDataLength}${encodedTokenDataElements}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1506,7 +1498,6 @@ describe('ERC1155Proxy', () => { authorized, assetDataWithBadTokenData, ), - RevertReason.InvalidDataOffset, ); }); it('should revert if asset data lies outside the bounds of calldata', async () => { @@ -1536,9 +1527,8 @@ describe('ERC1155Proxy', () => { const invalidOffsetToAssetData = '0000000000000000000000000000000000000000000000000000000000000180'; const badTxData = txData.replace(offsetToAssetData, invalidOffsetToAssetData); // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromRawAsync(badTxData, authorized), - RevertReason.InvalidAssetDataLength, ); }); it('should revert if asset data lies outside the bounds of calldata', async () => { @@ -1570,39 +1560,8 @@ describe('ERC1155Proxy', () => { const newAssetData = '0000000000000000000000000000000000000000000000000000000000000304'; const badTxData = `${txData.replace(offsetToAssetData, invalidOffsetToAssetData)}${newAssetData}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromRawAsync(badTxData, authorized), - RevertReason.InvalidAssetDataEnd, - ); - }); - it('should revert if length of assetData, excluding the selector, is not a multiple of 32', async () => { - // setup test parameters - const tokensToTransfer = fungibleTokens.slice(0, 1); - const valuesToTransfer = [fungibleValueToTransferLarge]; - const valueMultiplier = valueMultiplierSmall; - const erc1155ContractAddress = erc1155Wrapper.getContract().address; - const assetData = assetDataUtils.encodeERC1155AssetData( - erc1155ContractAddress, - tokensToTransfer, - valuesToTransfer, - receiverCallbackData, - ); - const extraData = '01'; - const assetDataWithExtraData = `${assetData}${extraData}`; - // execute transfer - await expectTransactionFailedAsync( - erc1155ProxyWrapper.transferFromAsync( - spender, - receiverContract, - erc1155Contract.address, - tokensToTransfer, - valuesToTransfer, - valueMultiplier, - receiverCallbackData, - authorized, - assetDataWithExtraData, - ), - RevertReason.InvalidAssetDataLength, ); }); it('should revert if length of assetData is less than 132 bytes', async () => { @@ -1618,7 +1577,7 @@ describe('ERC1155Proxy', () => { const zeros96Bytes = '0'.repeat(188); const assetData131Bytes = `${AssetProxyId.ERC1155}${zeros96Bytes}`; // execute transfer - await expectTransactionFailedAsync( + await expectTransactionFailedWithoutReasonAsync( erc1155ProxyWrapper.transferFromAsync( spender, receiverContract, @@ -1630,7 +1589,6 @@ describe('ERC1155Proxy', () => { authorized, assetData131Bytes, ), - RevertReason.InvalidAssetDataLength, ); }); it('should transfer nothing if value is zero', async () => { From aff8e1e025b91e24b3e065e5ca7e545c7aff826a Mon Sep 17 00:00:00 2001 From: Brandon Chow Date: Tue, 16 Jul 2019 09:51:18 -0700 Subject: [PATCH 07/18] Remove the timestamp from subproviders CHANGELOG.json (should be automatically added) and run 'yarn prettier' to format changes. --- packages/subproviders/CHANGELOG.json | 3 +-- .../test/unit/private_key_wallet_subprovider_test.ts | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 283989fa0a..70739d363a 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -6,8 +6,7 @@ "note": "Fix bug in Private Key subprovider causing checksummed tx.origin addresses to be rejected.", "pr": 1962 } - ], - "timestamp": 1563240294 + ] }, { "version": "4.1.1", diff --git a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts index 1a9cdd6bda..3d6b0cc9de 100644 --- a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts @@ -34,7 +34,10 @@ describe('PrivateKeyWalletSubprovider', () => { expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT); }); it('signs a transaction where the tx.origin is checksummed.', async () => { - const TX_DATA_CHECKSUMMED_ORIGIN = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_0_CHECKSUMMED }; + const TX_DATA_CHECKSUMMED_ORIGIN = { + ...fixtureData.TX_DATA, + from: fixtureData.TEST_RPC_ACCOUNT_0_CHECKSUMMED, + }; const txHex = await subprovider.signTransactionAsync(TX_DATA_CHECKSUMMED_ORIGIN); expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT); }); From 53136caaa4a0718ebd2a937c16d286f0ede27428 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 16 Jul 2019 16:00:38 -0700 Subject: [PATCH 08/18] Add test for when staticCallTarget is an EOA --- contracts/asset-proxy/test/static_call_proxy.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contracts/asset-proxy/test/static_call_proxy.ts b/contracts/asset-proxy/test/static_call_proxy.ts index 55db645fb2..36f38785a2 100644 --- a/contracts/asset-proxy/test/static_call_proxy.ts +++ b/contracts/asset-proxy/test/static_call_proxy.ts @@ -175,7 +175,7 @@ describe('StaticCallProxy', () => { RevertReason.UnexpectedStaticCallResult, ); }); - it('should be successful if a function call with no inputs is successful', async () => { + it('should be successful if a function call with no inputs and no outputs is successful', async () => { const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData(); const expectedResultHash = constants.KECCAK256_NULL; const assetData = assetDataUtils.encodeStaticCallAssetData( @@ -185,6 +185,12 @@ describe('StaticCallProxy', () => { ); await staticCallProxy.transferFrom.awaitTransactionSuccessAsync(assetData, fromAddress, toAddress, amount); }); + it('should be successful if the staticCallTarget is not a contract and no return value is expected', async () => { + const staticCallData = '0x0102030405060708'; + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData(toAddress, staticCallData, expectedResultHash); + await staticCallProxy.transferFrom.awaitTransactionSuccessAsync(assetData, fromAddress, toAddress, amount); + }); it('should be successful if a function call with one static input returns the correct value', async () => { const staticCallData = staticCallTarget.isOddNumber.getABIEncodedTransactionData(new BigNumber(1)); const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001'); From 9e41c3093b4dcdd31682acb195559d538d53220d Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Tue, 2 Jul 2019 18:04:28 -0700 Subject: [PATCH 09/18] Conforming to error codes in ERC1155 Proxy --- .../contracts/src/MultiAssetProxy.sol | 28 +++++ contracts/asset-proxy/test/proxies.ts | 118 +++++++++++++++++- 2 files changed, 144 insertions(+), 2 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol b/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol index b26d8c0138..a0261f872c 100644 --- a/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol +++ b/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol @@ -92,6 +92,34 @@ contract MultiAssetProxy is // Load offset to `assetData` let assetDataOffset := calldataload(4) + // Load length in bytes of `assetData` + let assetDataLength := calldataload(add(assetDataOffset, 4)) + + // Assert that the length of asset data: + // 1. Must be at least 132 bytes (see table above) + // 2. Must be a multiple of 32 (excluding the 4-byte selector) + if or(lt(assetDataLength, 132), mod(sub(assetDataLength, 4), 32)) { + // Revert with `Error("INVALID_ASSET_DATA_LENGTH")` + mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(64, 0x00000019494e56414c49445f41535345545f444154415f4c454e475448000000) + mstore(96, 0) + revert(0, 100) + } + + // End of asset data in calldata + // +4 for selector + // +32 for length field + let assetDataEnd := add(assetDataOffset, add(assetDataLength, 36)) + if gt(assetDataEnd, calldatasize()) { + // Revert with `Error("INVALID_ASSET_DATA_END")` + mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(64, 0x00000016494e56414c49445f41535345545f444154415f454e44000000000000) + mstore(96, 0) + revert(0, 100) + } + // Asset data itself is encoded as follows: // // | Area | Offset | Length | Contents | diff --git a/contracts/asset-proxy/test/proxies.ts b/contracts/asset-proxy/test/proxies.ts index 9ca88956c2..8003b1af58 100644 --- a/contracts/asset-proxy/test/proxies.ts +++ b/contracts/asset-proxy/test/proxies.ts @@ -23,7 +23,7 @@ import { } from '@0x/contracts-test-utils'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils } from '@0x/order-utils'; -import { RevertReason } from '@0x/types'; +import { AssetProxyId, RevertReason } from '@0x/types'; import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -1329,7 +1329,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; - const extraData = '0102030405060708'; + const extraData = '0102030405060708090001020304050607080900010203040506070809000102'; const assetData = `${assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData)}${extraData}`; const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, @@ -1624,6 +1624,120 @@ describe('Asset Transfer Proxies', () => { RevertReason.SenderNotAuthorized, ); }); + it('should revert if asset data overflows beyond the bounds of calldata', async () => { + const inputAmount = new BigNumber(1); + const erc20Amount = new BigNumber(10); + const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address); + const erc721Amount = new BigNumber(1); + const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); + const amounts = [erc20Amount, erc721Amount]; + const nestedAssetData = [erc20AssetData, erc721AssetData]; + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); + const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( + assetData, + fromAddress, + toAddress, + inputAmount, + ); + // append asset data to end of tx data with a length of 0x300 bytes, which will extend past actual calldata. + const offsetToAssetData = '0000000000000000000000000000000000000000000000000000000000000080'; + const invalidOffsetToAssetData = '00000000000000000000000000000000000000000000000000000000000002a0'; + const newAssetData = '0000000000000000000000000000000000000000000000000000000000000304'; + const badData = `${data.replace(offsetToAssetData, invalidOffsetToAssetData)}${newAssetData}`; + // execute transfer + await expectTransactionFailedAsync( + web3Wrapper.sendTransactionAsync({ + to: multiAssetProxy.address, + data: badData, + from: authorized, + }), + RevertReason.InvalidAssetDataEnd, + ); + }); + it('should revert if asset data resolves to a location beyond the bounds of calldata', async () => { + const inputAmount = new BigNumber(1); + const erc20Amount = new BigNumber(10); + const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address); + const erc721Amount = new BigNumber(1); + const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); + const amounts = [erc20Amount, erc721Amount]; + const nestedAssetData = [erc20AssetData, erc721AssetData]; + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); + const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( + assetData, + fromAddress, + toAddress, + inputAmount, + ); + const offsetToAssetData = '0000000000000000000000000000000000000000000000000000000000000080'; + const invalidOffsetToAssetData = '0000000000000000000000000000000000000000000000000000000000000400'; + const badData = data.replace(offsetToAssetData, invalidOffsetToAssetData); + // execute transfer + // note that this triggers `InvalidAssetDataLength` because the length is zero, otherwise it would + // trigger `InvalidAssetDataEnd`. + await expectTransactionFailedAsync( + web3Wrapper.sendTransactionAsync({ + to: multiAssetProxy.address, + data: badData, + from: authorized, + }), + RevertReason.InvalidAssetDataLength, + ); + }); + it('should revert if length of assetData, excluding the selector, is not a multiple of 32', async () => { + // setup test parameters + const inputAmount = new BigNumber(1); + const erc20Amount = new BigNumber(10); + const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address); + const erc721Amount = new BigNumber(1); + const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); + const amounts = [erc20Amount, erc721Amount]; + const nestedAssetData = [erc20AssetData, erc721AssetData]; + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); + const extraData = '01'; + const assetDataWithExtraData = `${assetData}${extraData}`; + const badData = assetProxyInterface.transferFrom.getABIEncodedTransactionData( + assetDataWithExtraData, + fromAddress, + toAddress, + inputAmount, + ); + // execute transfer + await expectTransactionFailedAsync( + web3Wrapper.sendTransactionAsync({ + to: multiAssetProxy.address, + data: badData, + from: authorized, + }), + RevertReason.InvalidAssetDataLength, + ); + }); + it('should revert if length of assetData is less than 132 bytes', async () => { + // setup test parameters + const inputAmount = new BigNumber(1); + // we'll construct asset data that has a 4 byte selector plus + // 96 byte payload. This results in asset data that is 100 bytes + // long and will trigger the `invalid length` error. + // we must be sure to use a # of bytes that is still %32 + // so that we know the error is not triggered by another check in the code. + const zeros96Bytes = '0'.repeat(188); + const assetData131Bytes = `${AssetProxyId.MultiAsset}${zeros96Bytes}`; + const badData = assetProxyInterface.transferFrom.getABIEncodedTransactionData( + assetData131Bytes, + fromAddress, + toAddress, + inputAmount, + ); + // execute transfer + await expectTransactionFailedAsync( + web3Wrapper.sendTransactionAsync({ + to: multiAssetProxy.address, + data: badData, + from: authorized, + }), + RevertReason.InvalidAssetDataLength, + ); + }); }); }); }); From a569815840149f8ee478bad411bec221d19b518c Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 10 Jul 2019 11:23:36 -0700 Subject: [PATCH 10/18] Fix assetData length check and improve readability --- .../contracts/src/MultiAssetProxy.sol | 77 ++++++++++--------- contracts/asset-proxy/test/proxies.ts | 10 +-- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol b/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol index a0261f872c..dfda0544a5 100644 --- a/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol +++ b/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol @@ -90,15 +90,31 @@ contract MultiAssetProxy is // offset to assetData. // Load offset to `assetData` - let assetDataOffset := calldataload(4) + let assetDataOffset := add(calldataload(4), 4) // Load length in bytes of `assetData` - let assetDataLength := calldataload(add(assetDataOffset, 4)) + let assetDataLength := calldataload(assetDataOffset) + + // Asset data itself is encoded as follows: + // + // | Area | Offset | Length | Contents | + // |----------|-------------|---------|-------------------------------------| + // | Header | 0 | 4 | assetProxyId | + // | Params | | 2 * 32 | function parameters: | + // | | 4 | | 1. offset to amounts (*) | + // | | 36 | | 2. offset to nestedAssetData (*) | + // | Data | | | amounts: | + // | | 68 | 32 | amounts Length | + // | | 100 | a | amounts Contents | + // | | | | nestedAssetData: | + // | | 100 + a | 32 | nestedAssetData Length | + // | | 132 + a | b | nestedAssetData Contents (offsets) | + // | | 132 + a + b | | nestedAssetData[0, ..., len] | // Assert that the length of asset data: - // 1. Must be at least 132 bytes (see table above) + // 1. Must be at least 68 bytes (see table above) // 2. Must be a multiple of 32 (excluding the 4-byte selector) - if or(lt(assetDataLength, 132), mod(sub(assetDataLength, 4), 32)) { + if or(lt(assetDataLength, 68), mod(sub(assetDataLength, 4), 32)) { // Revert with `Error("INVALID_ASSET_DATA_LENGTH")` mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) @@ -108,9 +124,9 @@ contract MultiAssetProxy is } // End of asset data in calldata - // +4 for selector - // +32 for length field - let assetDataEnd := add(assetDataOffset, add(assetDataLength, 36)) + // assetDataOffset + // + 32 (assetData len) + let assetDataEnd := add(assetDataOffset, add(assetDataLength, 32)) if gt(assetDataEnd, calldatasize()) { // Revert with `Error("INVALID_ASSET_DATA_END")` mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) @@ -120,57 +136,37 @@ contract MultiAssetProxy is revert(0, 100) } - // Asset data itself is encoded as follows: - // - // | Area | Offset | Length | Contents | - // |----------|-------------|---------|-------------------------------------| - // | Header | 0 | 4 | assetProxyId | - // | Params | | 2 * 32 | function parameters: | - // | | 4 | | 1. offset to amounts (*) | - // | | 36 | | 2. offset to nestedAssetData (*) | - // | Data | | | amounts: | - // | | 68 | 32 | amounts Length | - // | | 100 | a | amounts Contents | - // | | | | nestedAssetData: | - // | | 100 + a | 32 | nestedAssetData Length | - // | | 132 + a | b | nestedAssetData Contents (offsets) | - // | | 132 + a + b | | nestedAssetData[0, ..., len] | - // In order to find the offset to `amounts`, we must add: - // 4 (function selector) - // + assetDataOffset + // assetDataOffset // + 32 (assetData len) // + 4 (assetProxyId) - let amountsOffset := calldataload(add(assetDataOffset, 40)) + let amountsOffset := calldataload(add(assetDataOffset, 36)) // In order to find the offset to `nestedAssetData`, we must add: - // 4 (function selector) - // + assetDataOffset + // assetDataOffset // + 32 (assetData len) // + 4 (assetProxyId) // + 32 (amounts offset) - let nestedAssetDataOffset := calldataload(add(assetDataOffset, 72)) + let nestedAssetDataOffset := calldataload(add(assetDataOffset, 68)) // In order to find the start of the `amounts` contents, we must add: - // 4 (function selector) - // + assetDataOffset + // assetDataOffset // + 32 (assetData len) // + 4 (assetProxyId) // + amountsOffset // + 32 (amounts len) - let amountsContentsStart := add(assetDataOffset, add(amountsOffset, 72)) + let amountsContentsStart := add(assetDataOffset, add(amountsOffset, 68)) // Load number of elements in `amounts` let amountsLen := calldataload(sub(amountsContentsStart, 32)) // In order to find the start of the `nestedAssetData` contents, we must add: - // 4 (function selector) - // + assetDataOffset + // assetDataOffset // + 32 (assetData len) // + 4 (assetProxyId) // + nestedAssetDataOffset // + 32 (nestedAssetData len) - let nestedAssetDataContentsStart := add(assetDataOffset, add(nestedAssetDataOffset, 72)) + let nestedAssetDataContentsStart := add(assetDataOffset, add(nestedAssetDataOffset, 68)) // Load number of elements in `nestedAssetData` let nestedAssetDataLen := calldataload(sub(nestedAssetDataContentsStart, 32)) @@ -232,15 +228,20 @@ contract MultiAssetProxy is let nestedAssetDataElementOffset := calldataload(add(nestedAssetDataContentsStart, i)) // In order to find the start of the `nestedAssetData[i]` contents, we must add: - // 4 (function selector) - // + assetDataOffset + // assetDataOffset // + 32 (assetData len) // + 4 (assetProxyId) // + nestedAssetDataOffset // + 32 (nestedAssetData len) // + nestedAssetDataElementOffset // + 32 (nestedAssetDataElement len) - let nestedAssetDataElementContentsStart := add(assetDataOffset, add(nestedAssetDataOffset, add(nestedAssetDataElementOffset, 104))) + let nestedAssetDataElementContentsStart := add( + assetDataOffset, + add( + nestedAssetDataOffset, + add(nestedAssetDataElementOffset, 100) + ) + ) // Load length of `nestedAssetData[i]` let nestedAssetDataElementLenStart := sub(nestedAssetDataElementContentsStart, 32) diff --git a/contracts/asset-proxy/test/proxies.ts b/contracts/asset-proxy/test/proxies.ts index 8003b1af58..ffca38a77f 100644 --- a/contracts/asset-proxy/test/proxies.ts +++ b/contracts/asset-proxy/test/proxies.ts @@ -1712,18 +1712,18 @@ describe('Asset Transfer Proxies', () => { RevertReason.InvalidAssetDataLength, ); }); - it('should revert if length of assetData is less than 132 bytes', async () => { + it('should revert if length of assetData is less than 68 bytes', async () => { // setup test parameters const inputAmount = new BigNumber(1); // we'll construct asset data that has a 4 byte selector plus - // 96 byte payload. This results in asset data that is 100 bytes + // 32 byte payload. This results in asset data that is 36 bytes // long and will trigger the `invalid length` error. // we must be sure to use a # of bytes that is still %32 // so that we know the error is not triggered by another check in the code. - const zeros96Bytes = '0'.repeat(188); - const assetData131Bytes = `${AssetProxyId.MultiAsset}${zeros96Bytes}`; + const zeros32Bytes = '0'.repeat(64); + const assetData36Bytes = `${AssetProxyId.MultiAsset}${zeros32Bytes}`; const badData = assetProxyInterface.transferFrom.getABIEncodedTransactionData( - assetData131Bytes, + assetData36Bytes, fromAddress, toAddress, inputAmount, From d280ccb3c478ae45c12cb5b214a0e17398fc514d Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 10 Jul 2019 17:31:46 -0700 Subject: [PATCH 11/18] Add better validation to assetDataUtils --- packages/order-utils/src/asset_data_utils.ts | 53 ++++++++++++++++++-- packages/order-utils/src/constants.ts | 10 ++-- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index 1a07944726..e4220aa240 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -358,6 +358,7 @@ export const assetDataUtils = { }. Got ${assetData.length}`, ); } + assetDataUtils.assertWordAlignedAssetData(assetData); const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); if (assetProxyId !== AssetProxyId.ERC20) { throw new Error( @@ -379,6 +380,7 @@ export const assetDataUtils = { }. Got ${assetData.length}`, ); } + assetDataUtils.assertWordAlignedAssetData(assetData); const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); if (assetProxyId !== AssetProxyId.ERC721) { throw new Error( @@ -393,8 +395,22 @@ export const assetDataUtils = { * @param assetData Hex encoded assetData string */ assertIsERC1155AssetData(assetData: string): void { - // If the asset data is correctly decoded then it is valid. - assetDataUtils.decodeERC1155AssetData(assetData); + if (assetData.length < constants.ERC1155_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX) { + throw new Error( + `Could not decode ERC1155 Proxy Data. Expected length of encoded data to be at least ${ + constants.ERC1155_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX + }. Got ${assetData.length}`, + ); + } + assetDataUtils.assertWordAlignedAssetData(assetData); + const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); + if (assetProxyId !== AssetProxyId.ERC1155) { + throw new Error( + `Could not decode ERC1155 assetData. Expected assetProxyId to be ERC1155 (${ + AssetProxyId.ERC1155 + }), but got ${assetProxyId}`, + ); + } }, /** * Throws if the length or assetProxyId are invalid for the MultiAssetProxy. @@ -408,6 +424,7 @@ export const assetDataUtils = { }. Got ${assetData.length}`, ); } + assetDataUtils.assertWordAlignedAssetData(assetData); const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); if (assetProxyId !== AssetProxyId.MultiAsset) { throw new Error( @@ -422,7 +439,34 @@ export const assetDataUtils = { * @param assetData Hex encoded assetData string */ assertIsStaticCallAssetData(assetData: string): void { - assetDataUtils.decodeStaticCallAssetData(assetData); + if (assetData.length < constants.STATIC_CALL_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX) { + throw new Error( + `Could not decode StaticCall Proxy Data. Expected length of encoded data to be at least ${ + constants.STATIC_CALL_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX + }. Got ${assetData.length}`, + ); + } + assetDataUtils.assertWordAlignedAssetData(assetData); + const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); + if (assetProxyId !== AssetProxyId.StaticCall) { + throw new Error( + `Could not decode StaticCall assetData. Expected assetProxyId to be StaticCall (${ + AssetProxyId.StaticCall + }), but got ${assetProxyId}`, + ); + } + }, + /** + * Throws if the assetData is not padded to 32 bytes. + * @param assetData Hex encoded assetData string + */ + assertWordAlignedAssetData(assetData: string): void { + const charsIn32Bytes = 64; + if ((assetData.length - constants.SELECTOR_CHAR_LENGTH_WITH_PREFIX) % charsIn32Bytes !== 0) { + throw new Error( + `assetData must be word aligned. ${(assetData.length - 2) / 2} is not a valid byte length.`, + ); + } }, /** * Throws if the length or assetProxyId are invalid for the corresponding AssetProxy. @@ -470,6 +514,9 @@ export const assetDataUtils = { case AssetProxyId.MultiAsset: const multiAssetData = assetDataUtils.decodeMultiAssetData(assetData); return multiAssetData; + case AssetProxyId.StaticCall: + const staticCallData = assetDataUtils.decodeStaticCallAssetData(assetData); + return staticCallData; default: throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`); } diff --git a/packages/order-utils/src/constants.ts b/packages/order-utils/src/constants.ts index 5391cf2322..56573fb5ba 100644 --- a/packages/order-utils/src/constants.ts +++ b/packages/order-utils/src/constants.ts @@ -91,10 +91,12 @@ export const constants = { UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1), TESTRPC_NETWORK_ID: 50, ADDRESS_LENGTH: 20, - ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 74, - ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 136, - MULTI_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 266, - SELECTOR_CHAR_LENGTH_WITH_PREFIX: 10, + ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 74, // 36 bytes + ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 138, // 68 bytes + ERC1155_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 266, // 132 bytes + MULTI_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 138, // 68 bytes + STATIC_CALL_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 202, // 100 bytes + SELECTOR_CHAR_LENGTH_WITH_PREFIX: 10, // 4 bytes INFINITE_TIMESTAMP_SEC: new BigNumber(2524604400), // Close to infinite ZERO_AMOUNT: new BigNumber(0), EXCHANGE_DOMAIN_NAME: '0x Protocol', From eb2fb7f79095c8be6b3112f64d88a7b703dfc889 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 16 Jul 2019 14:26:09 -0700 Subject: [PATCH 12/18] Fix linting error --- packages/order-utils/src/asset_data_utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index e4220aa240..67423836c6 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -522,3 +522,4 @@ export const assetDataUtils = { } }, }; +// tslint:disable:max-file-line-count From 05d50b62c98b26d6f299f1125159610d8a247614 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 17 Jul 2019 09:37:25 -0700 Subject: [PATCH 13/18] Update CHANGELOG --- packages/order-utils/CHANGELOG.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 2cd0e6d02b..adcb3be2ab 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "8.2.3", + "changes": [ + { + "note": "Ensure `assetData` is word aligned", + "pr": 1964 + } + ] + }, { "timestamp": 1563193019, "version": "8.2.2", From 37bce536835eb33e376c7f9925831e1fde403e97 Mon Sep 17 00:00:00 2001 From: Xianny <8582774+xianny@users.noreply.github.com> Date: Wed, 17 Jul 2019 10:13:28 -0700 Subject: [PATCH 14/18] Normalize address inputs to lowercase in generated wrappers (#1951) --- .gitattributes | 2 +- .../partials/abi_type.handlebars | 8 +- .../partials/callAsync.handlebars | 6 +- .../partials/normalized_params.handlebars | 3 + .../abi-gen-templates/partials/tx.handlebars | 16 +- packages/abi-gen-wrappers/CHANGELOG.json | 4 + .../generated-wrappers/asset_proxy_owner.ts | 295 +++++++++++-- .../src/generated-wrappers/coordinator.ts | 92 +++- .../coordinator_registry.ts | 22 +- .../generated-wrappers/dummy_erc20_token.ts | 213 ++++++++-- .../generated-wrappers/dummy_erc721_token.ts | 307 +++++++++++--- .../src/generated-wrappers/dutch_auction.ts | 24 ++ .../src/generated-wrappers/erc20_proxy.ts | 132 ++++-- .../src/generated-wrappers/erc20_token.ts | 122 ++++-- .../src/generated-wrappers/erc721_proxy.ts | 132 ++++-- .../src/generated-wrappers/erc721_token.ts | 215 ++++++++-- .../generated-wrappers/eth_balance_checker.ts | 4 + .../src/generated-wrappers/exchange.ts | 396 ++++++++++++++++-- .../src/generated-wrappers/forwarder.ts | 122 +++++- .../src/generated-wrappers/i_asset_proxy.ts | 150 +++++-- .../src/generated-wrappers/i_validator.ts | 8 +- .../src/generated-wrappers/i_wallet.ts | 4 + .../generated-wrappers/multi_asset_proxy.ts | 166 ++++++-- .../src/generated-wrappers/order_validator.ts | 51 ++- .../src/generated-wrappers/weth9.ts | 160 +++++-- .../src/generated-wrappers/zrx_token.ts | 134 ++++-- packages/abi-gen/src/index.ts | 4 + .../expected-output/python/abi_gen_dummy.py | 38 +- .../typescript/abi_gen_dummy.ts | 129 ++++++ .../typescript/test_lib_dummy.ts | 8 + .../fixtures/artifacts/AbiGenDummy.json | 51 ++- .../fixtures/contracts/AbiGenDummy.sol | 10 + .../test/abi_gen_dummy_test.ts | 13 + 33 files changed, 2558 insertions(+), 483 deletions(-) create mode 100644 packages/abi-gen-templates/partials/normalized_params.handlebars diff --git a/.gitattributes b/.gitattributes index a1b3737234..f6d6b3c00a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,5 +3,5 @@ # Automatically collapse generated files in GitHub. *.svg linguist-generated=true packages/contract-artifacts/artifacts/*json linguist-generated=true -packages/abi-gen-wrappers/src/generated-wrappers/*.ts liguist-generated=true +packages/abi-gen-wrappers/src/generated-wrappers/*.ts linguist-generated=true diff --git a/packages/abi-gen-templates/partials/abi_type.handlebars b/packages/abi-gen-templates/partials/abi_type.handlebars index 4099fdc237..bfaad988a8 100644 --- a/packages/abi-gen-templates/partials/abi_type.handlebars +++ b/packages/abi-gen-templates/partials/abi_type.handlebars @@ -1,12 +1,10 @@ { name: '{{name}}', - type: '{{type}}', - {{#if (isDefined indexed)}}indexed: {{indexed}},{{/if}} - {{#if components}} + type: '{{type}}',{{#if (isDefined indexed)}} + indexed: {{indexed}},{{/if}}{{#if components}} components: [ {{#each components}} {{> abi_type this}} {{/each}} - ] - {{/if}} + ]{{/if}} }, diff --git a/packages/abi-gen-templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars index 6ab09169d7..adaf7098d9 100644 --- a/packages/abi-gen-templates/partials/callAsync.handlebars +++ b/packages/abi-gen-templates/partials/callAsync.handlebars @@ -15,7 +15,7 @@ async callAsync( assert.isBlockParam('defaultBlock', defaultBlock); } const self = this as any as {{contractName}}Contract; - const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -24,6 +24,8 @@ async callAsync( }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); @@ -39,6 +41,6 @@ getABIEncodedTransactionData( {{#assertionType name type}}{{/assertionType}} {{/each}} const self = this as any as {{contractName}}Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); + const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen-templates/partials/normalized_params.handlebars b/packages/abi-gen-templates/partials/normalized_params.handlebars new file mode 100644 index 0000000000..e6c180bda5 --- /dev/null +++ b/packages/abi-gen-templates/partials/normalized_params.handlebars @@ -0,0 +1,3 @@ +{{#each inputs}} +{{name}}{{#ifEquals 'address' type}}.toLowerCase(){{/ifEquals}}{{#if @last}}{{else}},{{/if}} +{{/each}} diff --git a/packages/abi-gen-templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars index ad6092fb4d..96787e7ae1 100644 --- a/packages/abi-gen-templates/partials/tx.handlebars +++ b/packages/abi-gen-templates/partials/tx.handlebars @@ -7,7 +7,7 @@ public {{languageSpecificName}} = { {{#assertionType name type}}{{/assertionType}} {{/each}} const self = this as any as {{contractName}}Contract; - const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -17,9 +17,13 @@ public {{languageSpecificName}} = { self._web3Wrapper.getContractDefaults(), self.{{languageSpecificName}}.estimateGasAsync.bind( self, - {{> params inputs=inputs}} + {{> normalized_params inputs=inputs}} ), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -34,7 +38,7 @@ public {{languageSpecificName}} = { {{/each}} const self = this as any as {{contractName}}Contract; {{#if inputs}} - const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync({{> params input=inputs}}, txData); + const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync({{> normalized_params input=inputs}}, txData); {{else}} const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync(txData); {{/if}} @@ -58,7 +62,7 @@ public {{languageSpecificName}} = { {{#assertionType name type}}{{/assertionType}} {{/each}} const self = this as any as {{contractName}}Contract; - const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -67,6 +71,10 @@ public {{languageSpecificName}} = { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index d3b646c771..f132b29808 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -32,6 +32,10 @@ "note": "Update wrappers to include parameter assertions", "pr": 1823 }, + { + "note": "Update wrappers to normalize address inputs to lowercase", + "pr": 1951 + }, { "note": "Update wrappers to include `getABIEncodedTransactionData` for view and pure functions", "pr": 1863 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts index 314b9549d9..dd2689fa7b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts @@ -134,6 +134,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); @@ -153,7 +157,7 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner]); + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -161,8 +165,12 @@ export class AssetProxyOwnerContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind(self, owner), + self.removeOwner.estimateGasAsync.bind(self, owner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -174,7 +182,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.removeOwner.sendTransactionAsync(owner, txData); + const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -190,7 +198,7 @@ export class AssetProxyOwnerContract extends BaseContract { async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner]); + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -199,6 +207,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -213,7 +225,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner]); + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -222,6 +234,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); @@ -233,7 +249,9 @@ export class AssetProxyOwnerContract extends BaseContract { getABIEncodedTransactionData(owner: string): string { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [ + owner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -251,6 +269,10 @@ export class AssetProxyOwnerContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.revokeConfirmation.estimateGasAsync.bind(self, transactionId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -287,6 +309,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -314,6 +340,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); @@ -347,7 +377,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0]); + const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -356,6 +386,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); @@ -367,7 +401,7 @@ export class AssetProxyOwnerContract extends BaseContract { getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0]); + const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -389,7 +423,10 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, index_1]); + const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [ + index_0, + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -398,6 +435,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); @@ -412,7 +453,7 @@ export class AssetProxyOwnerContract extends BaseContract { const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [ index_0, - index_1, + index_1.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -433,6 +474,10 @@ export class AssetProxyOwnerContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind(self, transactionId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -474,6 +519,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -503,6 +552,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); @@ -541,6 +594,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); @@ -582,6 +639,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); @@ -611,7 +672,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBoolean('isRegistered', isRegistered); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract, + assetProxyContract.toLowerCase(), isRegistered, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -621,8 +682,12 @@ export class AssetProxyOwnerContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxyContract, isRegistered), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxyContract.toLowerCase(), isRegistered), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -637,7 +702,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBoolean('isRegistered', isRegistered); const self = (this as any) as AssetProxyOwnerContract; const txHashPromise = self.registerAssetProxy.sendTransactionAsync( - assetProxyContract, + assetProxyContract.toLowerCase(), isRegistered, txData, ); @@ -662,7 +727,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBoolean('isRegistered', isRegistered); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract, + assetProxyContract.toLowerCase(), isRegistered, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -673,6 +738,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -694,7 +763,7 @@ export class AssetProxyOwnerContract extends BaseContract { } const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract, + assetProxyContract.toLowerCase(), isRegistered, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -705,6 +774,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); @@ -718,7 +791,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBoolean('isRegistered', isRegistered); const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract, + assetProxyContract.toLowerCase(), isRegistered, ]); return abiEncodedTransactionData; @@ -728,7 +801,7 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner]); + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -736,8 +809,12 @@ export class AssetProxyOwnerContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind(self, owner), + self.addOwner.estimateGasAsync.bind(self, owner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -749,7 +826,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.addOwner.sendTransactionAsync(owner, txData); + const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -765,7 +842,7 @@ export class AssetProxyOwnerContract extends BaseContract { async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner]); + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -774,6 +851,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -788,7 +869,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner]); + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -797,6 +878,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); @@ -808,7 +893,7 @@ export class AssetProxyOwnerContract extends BaseContract { getABIEncodedTransactionData(owner: string): string { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -837,6 +922,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); @@ -869,6 +958,10 @@ export class AssetProxyOwnerContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.changeTimeLock.estimateGasAsync.bind(self, _secondsTimeLocked), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -905,6 +998,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -932,6 +1029,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); @@ -965,7 +1066,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0]); + const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -974,6 +1075,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); @@ -985,7 +1090,9 @@ export class AssetProxyOwnerContract extends BaseContract { getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0]); + const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -1014,6 +1121,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); @@ -1056,6 +1167,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); @@ -1091,6 +1206,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getOwners()'); @@ -1141,6 +1260,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); @@ -1187,6 +1310,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); @@ -1222,6 +1349,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactionCount()'); @@ -1250,6 +1381,10 @@ export class AssetProxyOwnerContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.changeRequirement.estimateGasAsync.bind(self, _required), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1286,6 +1421,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1313,6 +1452,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); @@ -1342,6 +1485,10 @@ export class AssetProxyOwnerContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.confirmTransaction.estimateGasAsync.bind(self, transactionId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1378,6 +1525,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1405,6 +1556,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); @@ -1434,7 +1589,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('data', data); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination, + destination.toLowerCase(), value, data, ]); @@ -1445,8 +1600,12 @@ export class AssetProxyOwnerContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind(self, destination, value, data), + self.submitTransaction.estimateGasAsync.bind(self, destination.toLowerCase(), value, data), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1462,7 +1621,12 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBigNumber('value', value); assert.isString('data', data); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.submitTransaction.sendTransactionAsync(destination, value, data, txData); + const txHashPromise = self.submitTransaction.sendTransactionAsync( + destination.toLowerCase(), + value, + data, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -1486,7 +1650,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('data', data); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination, + destination.toLowerCase(), value, data, ]); @@ -1498,6 +1662,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1521,7 +1689,7 @@ export class AssetProxyOwnerContract extends BaseContract { } const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination, + destination.toLowerCase(), value, data, ]); @@ -1533,6 +1701,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); @@ -1547,7 +1719,7 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('data', data); const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination, + destination.toLowerCase(), value, data, ]); @@ -1579,6 +1751,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); @@ -1614,6 +1790,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); @@ -1648,6 +1828,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('required()'); @@ -1671,7 +1855,10 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('owner', owner); assert.isString('newOwner', newOwner); const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner]); + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1679,8 +1866,12 @@ export class AssetProxyOwnerContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind(self, owner, newOwner), + self.replaceOwner.estimateGasAsync.bind(self, owner.toLowerCase(), newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1694,7 +1885,11 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('owner', owner); assert.isString('newOwner', newOwner); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.replaceOwner.sendTransactionAsync(owner, newOwner, txData); + const txHashPromise = self.replaceOwner.sendTransactionAsync( + owner.toLowerCase(), + newOwner.toLowerCase(), + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -1711,7 +1906,10 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('owner', owner); assert.isString('newOwner', newOwner); const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner]); + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1720,6 +1918,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1740,7 +1942,10 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner]); + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1749,6 +1954,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); @@ -1762,8 +1971,8 @@ export class AssetProxyOwnerContract extends BaseContract { assert.isString('newOwner', newOwner); const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner, - newOwner, + owner.toLowerCase(), + newOwner.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -1782,6 +1991,10 @@ export class AssetProxyOwnerContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.executeTransaction.estimateGasAsync.bind(self, transactionId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1818,6 +2031,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1845,6 +2062,10 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 94d22b1887..1d86697b3d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -54,6 +54,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); @@ -99,6 +103,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); @@ -148,6 +156,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); @@ -186,7 +198,13 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments( 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], ); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -198,12 +216,16 @@ export class CoordinatorContract extends BaseContract { self.executeTransaction.estimateGasAsync.bind( self, transaction, - txOrigin, + txOrigin.toLowerCase(), transactionSignature, approvalExpirationTimeSeconds, approvalSignatures, ), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -224,7 +246,7 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const txHashPromise = self.executeTransaction.sendTransactionAsync( transaction, - txOrigin, + txOrigin.toLowerCase(), transactionSignature, approvalExpirationTimeSeconds, approvalSignatures, @@ -257,7 +279,13 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments( 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], ); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -267,6 +295,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -294,7 +326,13 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments( 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -304,6 +342,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -328,7 +370,13 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], ); return abiEncodedTransactionData; }, @@ -353,6 +401,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); @@ -392,7 +444,13 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments( 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -402,6 +460,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -426,7 +488,13 @@ export class CoordinatorContract extends BaseContract { const self = (this as any) as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], ); return abiEncodedTransactionData; }, @@ -471,6 +539,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); @@ -521,6 +593,10 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); 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 d05e4e6b18..4502db105a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -52,6 +52,10 @@ export class CoordinatorRegistryContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.setCoordinatorEndpoint.estimateGasAsync.bind(self, coordinatorEndpoint), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -88,6 +92,10 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -115,6 +123,10 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); @@ -148,7 +160,9 @@ export class CoordinatorRegistryContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator]); + const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -157,6 +171,10 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); @@ -169,7 +187,7 @@ export class CoordinatorRegistryContract extends BaseContract { assert.isString('coordinatorOperator', coordinatorOperator); const self = (this as any) as CoordinatorRegistryContract; const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator, + coordinatorOperator.toLowerCase(), ]); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts index f040d81c19..58c465ea81 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts @@ -66,6 +66,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); @@ -89,7 +93,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -97,8 +104,12 @@ export class DummyERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender, _value), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -112,7 +123,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender, _value, txData); + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -133,7 +144,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -142,6 +156,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -162,7 +180,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -171,6 +192,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); @@ -184,7 +209,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender, + _spender.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -210,6 +235,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); @@ -236,8 +265,8 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -247,8 +276,12 @@ export class DummyERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from, _to, _value), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -264,7 +297,12 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from, _to, _value, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -288,8 +326,8 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -300,6 +338,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -323,8 +365,8 @@ export class DummyERC20TokenContract extends BaseContract { } const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -335,6 +377,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); @@ -349,8 +395,8 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -376,6 +422,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); @@ -406,7 +456,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -415,6 +465,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); @@ -426,7 +480,7 @@ export class DummyERC20TokenContract extends BaseContract { getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -450,6 +504,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -484,6 +542,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); @@ -512,6 +574,10 @@ export class DummyERC20TokenContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.mint.estimateGasAsync.bind(self, _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -548,6 +614,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -571,6 +641,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); @@ -595,7 +669,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -603,8 +677,12 @@ export class DummyERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to, _value), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -618,7 +696,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to, _value, txData); + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -635,7 +713,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -644,6 +722,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -664,7 +746,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -673,6 +755,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); @@ -685,7 +771,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -707,7 +796,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner, _spender]); + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -716,6 +808,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); @@ -729,8 +825,8 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner, - _spender, + _owner.toLowerCase(), + _spender.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -744,7 +840,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_target', _target); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value]); + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -752,8 +851,12 @@ export class DummyERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind(self, _target, _value), + self.setBalance.estimateGasAsync.bind(self, _target.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -767,7 +870,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_target', _target); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.setBalance.sendTransactionAsync(_target, _value, txData); + const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -788,7 +891,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isString('_target', _target); assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value]); + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -797,6 +903,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -817,7 +927,10 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value]); + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -826,6 +939,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); @@ -839,7 +956,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target, + _target.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -849,7 +966,7 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -857,8 +974,12 @@ export class DummyERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -870,7 +991,7 @@ export class DummyERC20TokenContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -886,7 +1007,7 @@ export class DummyERC20TokenContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -895,6 +1016,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -909,7 +1034,7 @@ export class DummyERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -918,6 +1043,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -929,7 +1058,9 @@ export class DummyERC20TokenContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -953,6 +1084,10 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts index 9a2a28398d..3852687fc9 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts @@ -76,6 +76,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); @@ -115,6 +119,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); @@ -139,7 +147,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -147,8 +158,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _approved, _tokenId), + self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -162,7 +177,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved, _tokenId, txData); + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -183,7 +198,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -192,6 +210,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -212,7 +234,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -221,6 +246,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); @@ -234,7 +263,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved, + _approved.toLowerCase(), _tokenId, ]); return abiEncodedTransactionData; @@ -252,8 +281,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -263,8 +292,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from, _to, _tokenId), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -280,7 +313,12 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -304,8 +342,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -316,6 +354,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -339,8 +381,8 @@ export class DummyERC721TokenContract extends BaseContract { } const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -351,6 +393,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); @@ -365,8 +411,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); return abiEncodedTransactionData; @@ -381,7 +427,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId]); + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -389,8 +435,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind(self, _to, _tokenId), + self.mint.estimateGasAsync.bind(self, _to.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -404,7 +454,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_to, _tokenId, txData); + const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), _tokenId, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -425,7 +475,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId]); + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -434,6 +484,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -454,7 +508,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId]); + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -463,6 +517,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); @@ -475,7 +533,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId]); + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [ + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -491,8 +552,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -502,8 +563,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind(self, _from, _to, _tokenId), + self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -519,7 +584,12 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData); + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -543,8 +613,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -555,6 +625,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -578,8 +652,8 @@ export class DummyERC721TokenContract extends BaseContract { } const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -590,6 +664,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); @@ -604,8 +682,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); return abiEncodedTransactionData; @@ -636,6 +714,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); @@ -667,7 +749,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -676,6 +758,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); @@ -687,7 +773,7 @@ export class DummyERC721TokenContract extends BaseContract { getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -711,6 +797,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -745,6 +835,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); @@ -768,7 +862,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId]); + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -776,8 +870,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.burn.estimateGasAsync.bind(self, _owner, _tokenId), + self.burn.estimateGasAsync.bind(self, _owner.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -791,7 +889,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.burn.sendTransactionAsync(_owner, _tokenId, txData); + const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), _tokenId, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -812,7 +910,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId]); + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -821,6 +919,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -841,7 +943,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId]); + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -850,6 +952,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); @@ -862,7 +968,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId]); + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [ + _owner.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -875,7 +984,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved]); + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -883,8 +995,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind(self, _operator, _approved), + self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -898,7 +1014,11 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator, _approved, txData); + const txHashPromise = self.setApprovalForAll.sendTransactionAsync( + _operator.toLowerCase(), + _approved, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -919,7 +1039,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved]); + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -928,6 +1051,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -948,7 +1075,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved]); + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -957,6 +1087,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); @@ -970,7 +1104,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBoolean('_approved', _approved); const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator, + _operator.toLowerCase(), _approved, ]); return abiEncodedTransactionData; @@ -990,8 +1124,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_data', _data); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, _data, ]); @@ -1002,8 +1136,18 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind(self, _from, _to, _tokenId, _data), + self.safeTransferFrom2.estimateGasAsync.bind( + self, + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1021,7 +1165,13 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from, _to, _tokenId, _data, txData); + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -1047,8 +1197,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_data', _data); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, _data, ]); @@ -1060,6 +1210,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1085,8 +1239,8 @@ export class DummyERC721TokenContract extends BaseContract { } const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, _data, ]); @@ -1098,6 +1252,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); @@ -1114,7 +1272,7 @@ export class DummyERC721TokenContract extends BaseContract { const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'safeTransferFrom(address,address,uint256,bytes)', - [_from, _to, _tokenId, _data], + [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], ); return abiEncodedTransactionData; }, @@ -1137,7 +1295,10 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, _operator]); + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1146,6 +1307,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); @@ -1159,8 +1324,8 @@ export class DummyERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner, - _operator, + _owner.toLowerCase(), + _operator.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -1169,7 +1334,7 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1177,8 +1342,12 @@ export class DummyERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1190,7 +1359,7 @@ export class DummyERC721TokenContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -1206,7 +1375,7 @@ export class DummyERC721TokenContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1215,6 +1384,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1229,7 +1402,7 @@ export class DummyERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1238,6 +1411,10 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -1249,7 +1426,9 @@ export class DummyERC721TokenContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts index a2c0877b5f..5073a0d510 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -59,6 +59,10 @@ export class DutchAuctionContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.getAuctionDetails.estimateGasAsync.bind(self, order), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -125,6 +129,10 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -174,6 +182,10 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -263,6 +275,10 @@ export class DutchAuctionContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.matchOrders.estimateGasAsync.bind(self, buyOrder, sellOrder, buySignature, sellSignature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -371,6 +387,10 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -445,6 +465,10 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts index bd02a4e1ea..cf54c78d8b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -50,7 +50,7 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -58,8 +58,12 @@ export class ERC20ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -71,7 +75,7 @@ export class ERC20ProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -87,7 +91,7 @@ export class ERC20ProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -96,6 +100,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -110,7 +118,7 @@ export class ERC20ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -119,6 +127,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); @@ -130,7 +142,9 @@ export class ERC20ProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -159,6 +173,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); @@ -178,7 +196,7 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -186,8 +204,12 @@ export class ERC20ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -199,7 +221,7 @@ export class ERC20ProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -215,7 +237,7 @@ export class ERC20ProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -224,6 +246,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -238,7 +264,7 @@ export class ERC20ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -247,6 +273,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); @@ -258,7 +288,9 @@ export class ERC20ProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -282,6 +314,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -306,7 +342,7 @@ export class ERC20ProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -316,8 +352,12 @@ export class ERC20ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target, index), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -331,7 +371,11 @@ export class ERC20ProxyContract extends BaseContract { assert.isString('target', target); assert.isBigNumber('index', index); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target, index, txData); + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -353,7 +397,7 @@ export class ERC20ProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -364,6 +408,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -385,7 +433,7 @@ export class ERC20ProxyContract extends BaseContract { } const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -396,6 +444,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); @@ -410,7 +462,7 @@ export class ERC20ProxyContract extends BaseContract { const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'removeAuthorizedAddressAtIndex(address,uint256)', - [target, index], + [target.toLowerCase(), index], ); return abiEncodedTransactionData; }, @@ -435,6 +487,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); @@ -465,7 +521,7 @@ export class ERC20ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0]); + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -474,6 +530,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); @@ -485,7 +545,9 @@ export class ERC20ProxyContract extends BaseContract { getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0]); + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -509,6 +571,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); @@ -527,7 +593,7 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -535,8 +601,12 @@ export class ERC20ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -548,7 +618,7 @@ export class ERC20ProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -564,7 +634,7 @@ export class ERC20ProxyContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -573,6 +643,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -587,7 +661,7 @@ export class ERC20ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -596,6 +670,10 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -607,7 +685,9 @@ export class ERC20ProxyContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts index 84d54eaf88..8f0812c7f7 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -55,7 +55,10 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -63,8 +66,12 @@ export class ERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender, _value), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -78,7 +85,7 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender, _value, txData); + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -99,7 +106,10 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -108,6 +118,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -128,7 +142,10 @@ export class ERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -137,6 +154,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); @@ -150,7 +171,7 @@ export class ERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender, + _spender.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -176,6 +197,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); @@ -202,8 +227,8 @@ export class ERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -213,8 +238,12 @@ export class ERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from, _to, _value), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -230,7 +259,12 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from, _to, _value, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -254,8 +288,8 @@ export class ERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -266,6 +300,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -289,8 +327,8 @@ export class ERC20TokenContract extends BaseContract { } const self = (this as any) as ERC20TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -301,6 +339,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); @@ -315,8 +357,8 @@ export class ERC20TokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -338,7 +380,7 @@ export class ERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -347,6 +389,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); @@ -358,7 +404,7 @@ export class ERC20TokenContract extends BaseContract { getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -371,7 +417,7 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -379,8 +425,12 @@ export class ERC20TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to, _value), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -394,7 +444,7 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to, _value, txData); + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -411,7 +461,7 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -420,6 +470,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -440,7 +494,7 @@ export class ERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -449,6 +503,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); @@ -461,7 +519,10 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -483,7 +544,10 @@ export class ERC20TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner, _spender]); + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -492,6 +556,10 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); @@ -505,8 +573,8 @@ export class ERC20TokenContract extends BaseContract { assert.isString('_spender', _spender); const self = (this as any) as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner, - _spender, + _owner.toLowerCase(), + _spender.toLowerCase(), ]); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts index c75e7e9133..c8664c3b1a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -50,7 +50,7 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -58,8 +58,12 @@ export class ERC721ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -71,7 +75,7 @@ export class ERC721ProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -87,7 +91,7 @@ export class ERC721ProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -96,6 +100,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -110,7 +118,7 @@ export class ERC721ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -119,6 +127,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); @@ -130,7 +142,9 @@ export class ERC721ProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -159,6 +173,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); @@ -178,7 +196,7 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -186,8 +204,12 @@ export class ERC721ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -199,7 +221,7 @@ export class ERC721ProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -215,7 +237,7 @@ export class ERC721ProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -224,6 +246,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -238,7 +264,7 @@ export class ERC721ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -247,6 +273,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); @@ -258,7 +288,9 @@ export class ERC721ProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -282,6 +314,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -306,7 +342,7 @@ export class ERC721ProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -316,8 +352,12 @@ export class ERC721ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target, index), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -331,7 +371,11 @@ export class ERC721ProxyContract extends BaseContract { assert.isString('target', target); assert.isBigNumber('index', index); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target, index, txData); + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -353,7 +397,7 @@ export class ERC721ProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -364,6 +408,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -385,7 +433,7 @@ export class ERC721ProxyContract extends BaseContract { } const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -396,6 +444,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); @@ -410,7 +462,7 @@ export class ERC721ProxyContract extends BaseContract { const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'removeAuthorizedAddressAtIndex(address,uint256)', - [target, index], + [target.toLowerCase(), index], ); return abiEncodedTransactionData; }, @@ -435,6 +487,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); @@ -465,7 +521,7 @@ export class ERC721ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0]); + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -474,6 +530,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); @@ -485,7 +545,9 @@ export class ERC721ProxyContract extends BaseContract { getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0]); + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -509,6 +571,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); @@ -527,7 +593,7 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -535,8 +601,12 @@ export class ERC721ProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -548,7 +618,7 @@ export class ERC721ProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -564,7 +634,7 @@ export class ERC721ProxyContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -573,6 +643,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -587,7 +661,7 @@ export class ERC721ProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -596,6 +670,10 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -607,7 +685,9 @@ export class ERC721ProxyContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts index 49e167767f..3a271860d5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -81,6 +81,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); @@ -105,7 +109,10 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -113,8 +120,12 @@ export class ERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _approved, _tokenId), + self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -128,7 +139,7 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved, _tokenId, txData); + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -149,7 +160,10 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -158,6 +172,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -178,7 +196,10 @@ export class ERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -187,6 +208,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); @@ -200,7 +225,7 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved, + _approved.toLowerCase(), _tokenId, ]); return abiEncodedTransactionData; @@ -218,8 +243,8 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -229,8 +254,12 @@ export class ERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from, _to, _tokenId), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -246,7 +275,12 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -270,8 +304,8 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -282,6 +316,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -305,8 +343,8 @@ export class ERC721TokenContract extends BaseContract { } const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -317,6 +355,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); @@ -331,8 +373,8 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); return abiEncodedTransactionData; @@ -350,8 +392,8 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -361,8 +403,12 @@ export class ERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind(self, _from, _to, _tokenId), + self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -378,7 +424,12 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData); + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -402,8 +453,8 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -414,6 +465,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -437,8 +492,8 @@ export class ERC721TokenContract extends BaseContract { } const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -449,6 +504,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); @@ -463,8 +522,8 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); const self = (this as any) as ERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, ]); return abiEncodedTransactionData; @@ -495,6 +554,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); @@ -526,7 +589,7 @@ export class ERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -535,6 +598,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); @@ -546,7 +613,7 @@ export class ERC721TokenContract extends BaseContract { getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -559,7 +626,10 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved]); + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -567,8 +637,12 @@ export class ERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind(self, _operator, _approved), + self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -582,7 +656,11 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator, _approved, txData); + const txHashPromise = self.setApprovalForAll.sendTransactionAsync( + _operator.toLowerCase(), + _approved, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -603,7 +681,10 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved]); + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -612,6 +693,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -632,7 +717,10 @@ export class ERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved]); + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -641,6 +729,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); @@ -654,7 +746,7 @@ export class ERC721TokenContract extends BaseContract { assert.isBoolean('_approved', _approved); const self = (this as any) as ERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator, + _operator.toLowerCase(), _approved, ]); return abiEncodedTransactionData; @@ -674,8 +766,8 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_data', _data); const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, _data, ]); @@ -686,8 +778,18 @@ export class ERC721TokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind(self, _from, _to, _tokenId, _data), + self.safeTransferFrom2.estimateGasAsync.bind( + self, + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -705,7 +807,13 @@ export class ERC721TokenContract extends BaseContract { assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from, _to, _tokenId, _data, txData); + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -731,8 +839,8 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_data', _data); const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, _data, ]); @@ -744,6 +852,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -769,8 +881,8 @@ export class ERC721TokenContract extends BaseContract { } const self = (this as any) as ERC721TokenContract; const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _tokenId, _data, ]); @@ -782,6 +894,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); @@ -798,7 +914,7 @@ export class ERC721TokenContract extends BaseContract { const self = (this as any) as ERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'safeTransferFrom(address,address,uint256,bytes)', - [_from, _to, _tokenId, _data], + [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], ); return abiEncodedTransactionData; }, @@ -821,7 +937,10 @@ export class ERC721TokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, _operator]); + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -830,6 +949,10 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); @@ -843,8 +966,8 @@ export class ERC721TokenContract extends BaseContract { assert.isString('_operator', _operator); const self = (this as any) as ERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner, - _operator, + _owner.toLowerCase(), + _operator.toLowerCase(), ]); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts index 195d1a862c..786f61b3a5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts @@ -52,6 +52,10 @@ export class EthBalanceCheckerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index b791c92be0..485bc8c1dd 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -107,6 +107,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); @@ -159,6 +163,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.batchFillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -240,6 +248,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -292,6 +304,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -361,6 +377,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); @@ -389,7 +409,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -399,8 +419,12 @@ export class ExchangeContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind(self, hash, signerAddress, signature), + self.preSign.estimateGasAsync.bind(self, hash, signerAddress.toLowerCase(), signature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -416,7 +440,12 @@ export class ExchangeContract extends BaseContract { assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); const self = (this as any) as ExchangeContract; - const txHashPromise = self.preSign.sendTransactionAsync(hash, signerAddress, signature, txData); + const txHashPromise = self.preSign.sendTransactionAsync( + hash, + signerAddress.toLowerCase(), + signature, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -441,7 +470,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -452,6 +481,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -476,7 +509,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -487,6 +520,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); @@ -502,7 +539,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); return abiEncodedTransactionData; @@ -558,6 +595,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.matchOrders.estimateGasAsync.bind(self, leftOrder, rightOrder, leftSignature, rightSignature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -666,6 +707,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -740,6 +785,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -842,6 +891,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.fillOrderNoThrow.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -921,6 +974,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -972,6 +1029,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -1036,6 +1097,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); @@ -1084,6 +1149,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.batchCancelOrders.estimateGasAsync.bind(self, orders), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1152,6 +1221,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1195,6 +1268,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -1267,6 +1344,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.batchFillOrKillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1348,6 +1429,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1400,6 +1485,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -1458,6 +1547,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.cancelOrdersUpTo.estimateGasAsync.bind(self, targetOrderEpoch), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1494,6 +1587,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1521,6 +1618,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); @@ -1575,6 +1676,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.batchFillOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1656,6 +1761,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1708,6 +1817,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -1777,6 +1890,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); @@ -1817,6 +1934,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); @@ -1868,6 +1989,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.fillOrKillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1947,6 +2072,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -1998,6 +2127,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -2051,7 +2184,7 @@ export class ExchangeContract extends BaseContract { assert.isBoolean('approval', approval); const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress, + validatorAddress.toLowerCase(), approval, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2061,8 +2194,16 @@ export class ExchangeContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind(self, validatorAddress, approval), - ); + self.setSignatureValidatorApproval.estimateGasAsync.bind( + self, + validatorAddress.toLowerCase(), + approval, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2077,7 +2218,7 @@ export class ExchangeContract extends BaseContract { assert.isBoolean('approval', approval); const self = (this as any) as ExchangeContract; const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync( - validatorAddress, + validatorAddress.toLowerCase(), approval, txData, ); @@ -2102,7 +2243,7 @@ export class ExchangeContract extends BaseContract { assert.isBoolean('approval', approval); const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress, + validatorAddress.toLowerCase(), approval, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2113,6 +2254,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -2134,7 +2279,7 @@ export class ExchangeContract extends BaseContract { } const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress, + validatorAddress.toLowerCase(), approval, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2145,6 +2290,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); @@ -2159,7 +2308,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'setSignatureValidatorApproval(address,bool)', - [validatorAddress, approval], + [validatorAddress.toLowerCase(), approval], ); return abiEncodedTransactionData; }, @@ -2182,7 +2331,10 @@ export class ExchangeContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0, index_1]); + const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2191,6 +2343,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); @@ -2204,8 +2360,8 @@ export class ExchangeContract extends BaseContract { assert.isString('index_1', index_1); const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [ - index_0, - index_1, + index_0.toLowerCase(), + index_1.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -2247,6 +2403,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.marketSellOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2328,6 +2488,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -2380,6 +2544,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -2465,6 +2633,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -2520,7 +2692,10 @@ export class ExchangeContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, index_1]); + const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [ + index_0, + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2529,6 +2704,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); @@ -2543,7 +2722,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [ index_0, - index_1, + index_1.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -2568,6 +2747,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -2604,7 +2787,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2615,6 +2798,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); @@ -2630,7 +2817,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); return abiEncodedTransactionData; @@ -2673,6 +2860,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.marketBuyOrdersNoThrow.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2754,6 +2945,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -2806,6 +3001,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -2886,6 +3085,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.fillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2960,6 +3163,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -3011,6 +3218,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -3069,7 +3280,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ salt, - signerAddress, + signerAddress.toLowerCase(), data, signature, ]); @@ -3080,8 +3291,12 @@ export class ExchangeContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind(self, salt, signerAddress, data, signature), + self.executeTransaction.estimateGasAsync.bind(self, salt, signerAddress.toLowerCase(), data, signature), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3101,7 +3316,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const txHashPromise = self.executeTransaction.sendTransactionAsync( salt, - signerAddress, + signerAddress.toLowerCase(), data, signature, txData, @@ -3132,7 +3347,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ salt, - signerAddress, + signerAddress.toLowerCase(), data, signature, ]); @@ -3144,6 +3359,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -3170,7 +3389,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ salt, - signerAddress, + signerAddress.toLowerCase(), data, signature, ]); @@ -3182,6 +3401,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); @@ -3198,7 +3421,7 @@ export class ExchangeContract extends BaseContract { const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'executeTransaction(uint256,address,bytes,bytes)', - [salt, signerAddress, data, signature], + [salt, signerAddress.toLowerCase(), data, signature], ); return abiEncodedTransactionData; }, @@ -3207,7 +3430,7 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { assert.isString('assetProxy', assetProxy); const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3215,8 +3438,12 @@ export class ExchangeContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3228,7 +3455,7 @@ export class ExchangeContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('assetProxy', assetProxy); const self = (this as any) as ExchangeContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy, txData); + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -3244,7 +3471,7 @@ export class ExchangeContract extends BaseContract { async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { assert.isString('assetProxy', assetProxy); const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3253,6 +3480,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -3271,7 +3502,7 @@ export class ExchangeContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3280,6 +3511,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); @@ -3291,7 +3526,9 @@ export class ExchangeContract extends BaseContract { getABIEncodedTransactionData(assetProxy: string): string { assert.isString('assetProxy', assetProxy); const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ + assetProxy.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -3335,6 +3572,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -3403,6 +3644,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.cancelOrder.estimateGasAsync.bind(self, order), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3469,6 +3714,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -3511,6 +3760,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -3561,7 +3814,10 @@ export class ExchangeContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0, index_1]); + const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3570,6 +3826,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); @@ -3583,8 +3843,8 @@ export class ExchangeContract extends BaseContract { assert.isString('index_1', index_1); const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [ - index_0, - index_1, + index_0.toLowerCase(), + index_1.toLowerCase(), ]); return abiEncodedTransactionData; }, @@ -3609,6 +3869,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); @@ -3660,6 +3924,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.marketSellOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3741,6 +4009,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -3793,6 +4065,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -3857,6 +4133,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); @@ -3908,6 +4188,10 @@ export class ExchangeContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.marketBuyOrders.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3989,6 +4273,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -4041,6 +4329,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -4105,6 +4397,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); @@ -4123,7 +4419,7 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4131,8 +4427,12 @@ export class ExchangeContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -4144,7 +4444,7 @@ export class ExchangeContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ExchangeContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -4160,7 +4460,7 @@ export class ExchangeContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4169,6 +4469,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -4183,7 +4487,7 @@ export class ExchangeContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4192,6 +4496,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -4203,7 +4511,9 @@ export class ExchangeContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -4227,6 +4537,10 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('VERSION()'); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 184b8fb1c7..d744d34ba7 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -74,7 +74,15 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments( 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, makerAssetFillAmount, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], ); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -91,9 +99,13 @@ export class ForwarderContract extends BaseContract { feeOrders, feeSignatures, feePercentage, - feeRecipient, + feeRecipient.toLowerCase(), ), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -150,7 +162,7 @@ export class ForwarderContract extends BaseContract { feeOrders, feeSignatures, feePercentage, - feeRecipient, + feeRecipient.toLowerCase(), txData, ); return new PromiseWithTransactionHash( @@ -211,7 +223,15 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments( 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, makerAssetFillAmount, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], ); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -221,6 +241,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -294,7 +318,15 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments( 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, makerAssetFillAmount, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -304,6 +336,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -374,7 +410,15 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, makerAssetFillAmount, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], ); return abiEncodedTransactionData; }, @@ -398,6 +442,10 @@ export class ForwarderContract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.withdrawAsset.estimateGasAsync.bind(self, assetData, amount), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -441,6 +489,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -470,6 +522,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); @@ -509,6 +565,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -568,7 +628,7 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments( 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], ); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -584,9 +644,13 @@ export class ForwarderContract extends BaseContract { feeOrders, feeSignatures, feePercentage, - feeRecipient, + feeRecipient.toLowerCase(), ), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -640,7 +704,7 @@ export class ForwarderContract extends BaseContract { feeOrders, feeSignatures, feePercentage, - feeRecipient, + feeRecipient.toLowerCase(), txData, ); return new PromiseWithTransactionHash( @@ -699,7 +763,7 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments( 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], ); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -709,6 +773,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -780,7 +848,7 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments( 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -790,6 +858,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -858,7 +930,7 @@ export class ForwarderContract extends BaseContract { const self = (this as any) as ForwarderContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient], + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], ); return abiEncodedTransactionData; }, @@ -867,7 +939,7 @@ export class ForwarderContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -875,8 +947,12 @@ export class ForwarderContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -888,7 +964,7 @@ export class ForwarderContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ForwarderContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -904,7 +980,7 @@ export class ForwarderContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -913,6 +989,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -927,7 +1007,7 @@ export class ForwarderContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -936,6 +1016,10 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -947,7 +1031,9 @@ export class ForwarderContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts index bee96c405b..08753c6a21 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts @@ -31,7 +31,7 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -39,8 +39,12 @@ export class IAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -52,7 +56,7 @@ export class IAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -68,7 +72,7 @@ export class IAssetProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -77,6 +81,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -91,7 +99,7 @@ export class IAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -100,6 +108,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); @@ -111,7 +123,9 @@ export class IAssetProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -119,7 +133,7 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -127,8 +141,12 @@ export class IAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -140,7 +158,7 @@ export class IAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -156,7 +174,7 @@ export class IAssetProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -165,6 +183,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -179,7 +201,7 @@ export class IAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -188,6 +210,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); @@ -199,7 +225,9 @@ export class IAssetProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -213,7 +241,7 @@ export class IAssetProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -223,8 +251,12 @@ export class IAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target, index), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -238,7 +270,11 @@ export class IAssetProxyContract extends BaseContract { assert.isString('target', target); assert.isBigNumber('index', index); const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target, index, txData); + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -260,7 +296,7 @@ export class IAssetProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -271,6 +307,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -292,7 +332,7 @@ export class IAssetProxyContract extends BaseContract { } const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -303,6 +343,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); @@ -317,7 +361,7 @@ export class IAssetProxyContract extends BaseContract { const self = (this as any) as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'removeAuthorizedAddressAtIndex(address,uint256)', - [target, index], + [target.toLowerCase(), index], ); return abiEncodedTransactionData; }, @@ -337,8 +381,8 @@ export class IAssetProxyContract extends BaseContract { const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ assetData, - from, - to, + from.toLowerCase(), + to.toLowerCase(), amount, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -348,8 +392,12 @@ export class IAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, assetData, from, to, amount), + self.transferFrom.estimateGasAsync.bind(self, assetData, from.toLowerCase(), to.toLowerCase(), amount), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -367,7 +415,13 @@ export class IAssetProxyContract extends BaseContract { assert.isString('to', to); assert.isBigNumber('amount', amount); const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(assetData, from, to, amount, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -394,8 +448,8 @@ export class IAssetProxyContract extends BaseContract { const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ assetData, - from, - to, + from.toLowerCase(), + to.toLowerCase(), amount, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -406,6 +460,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -432,8 +490,8 @@ export class IAssetProxyContract extends BaseContract { const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ assetData, - from, - to, + from.toLowerCase(), + to.toLowerCase(), amount, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -444,6 +502,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); @@ -460,7 +522,7 @@ export class IAssetProxyContract extends BaseContract { const self = (this as any) as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'transferFrom(bytes,address,address,uint256)', - [assetData, from, to, amount], + [assetData, from.toLowerCase(), to.toLowerCase(), amount], ); return abiEncodedTransactionData; }, @@ -485,6 +547,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); @@ -519,6 +585,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); @@ -537,7 +607,7 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -545,8 +615,12 @@ export class IAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -558,7 +632,7 @@ export class IAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -574,7 +648,7 @@ export class IAssetProxyContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -583,6 +657,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -597,7 +675,7 @@ export class IAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -606,6 +684,10 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -617,7 +699,9 @@ export class IAssetProxyContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts index 9ed7551e28..5f32cf4fea 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -49,7 +49,7 @@ export class IValidatorContract extends BaseContract { const self = (this as any) as IValidatorContract; const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -60,6 +60,10 @@ export class IValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); @@ -75,7 +79,7 @@ export class IValidatorContract extends BaseContract { const self = (this as any) as IValidatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ hash, - signerAddress, + signerAddress.toLowerCase(), signature, ]); return abiEncodedTransactionData; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts index fe25c4f6c7..3f653ea9c3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -54,6 +54,10 @@ export class IWalletContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts index a469633f7a..119b1d76fb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts @@ -74,6 +74,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); @@ -93,7 +97,7 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -101,8 +105,12 @@ export class MultiAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -114,7 +122,7 @@ export class MultiAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -130,7 +138,7 @@ export class MultiAssetProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -139,6 +147,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -153,7 +165,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -162,6 +174,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); @@ -173,7 +189,9 @@ export class MultiAssetProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -202,6 +220,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); @@ -242,6 +264,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); @@ -261,7 +287,7 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -269,8 +295,12 @@ export class MultiAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -282,7 +312,7 @@ export class MultiAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target, txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -298,7 +328,7 @@ export class MultiAssetProxyContract extends BaseContract { async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -307,6 +337,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -321,7 +355,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -330,6 +364,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); @@ -341,7 +379,9 @@ export class MultiAssetProxyContract extends BaseContract { getABIEncodedTransactionData(target: string): string { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target]); + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -365,6 +405,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); @@ -389,7 +433,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -399,8 +443,12 @@ export class MultiAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target, index), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -414,7 +462,11 @@ export class MultiAssetProxyContract extends BaseContract { assert.isString('target', target); assert.isBigNumber('index', index); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target, index, txData); + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -436,7 +488,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBigNumber('index', index); const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -447,6 +499,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -468,7 +524,7 @@ export class MultiAssetProxyContract extends BaseContract { } const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target, + target.toLowerCase(), index, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -479,6 +535,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); @@ -493,7 +553,7 @@ export class MultiAssetProxyContract extends BaseContract { const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'removeAuthorizedAddressAtIndex(address,uint256)', - [target, index], + [target.toLowerCase(), index], ); return abiEncodedTransactionData; }, @@ -518,6 +578,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); @@ -548,7 +612,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0]); + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -557,6 +621,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); @@ -568,7 +636,9 @@ export class MultiAssetProxyContract extends BaseContract { getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0]); + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -576,7 +646,7 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { assert.isString('assetProxy', assetProxy); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -584,8 +654,12 @@ export class MultiAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -597,7 +671,7 @@ export class MultiAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('assetProxy', assetProxy); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy, txData); + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -613,7 +687,7 @@ export class MultiAssetProxyContract extends BaseContract { async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { assert.isString('assetProxy', assetProxy); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -622,6 +696,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -640,7 +718,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -649,6 +727,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); @@ -660,7 +742,9 @@ export class MultiAssetProxyContract extends BaseContract { getABIEncodedTransactionData(assetProxy: string): string { assert.isString('assetProxy', assetProxy); const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy]); + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ + assetProxy.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -684,6 +768,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); @@ -702,7 +790,7 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -710,8 +798,12 @@ export class MultiAssetProxyContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -723,7 +815,7 @@ export class MultiAssetProxyContract extends BaseContract { ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner, txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -739,7 +831,7 @@ export class MultiAssetProxyContract extends BaseContract { async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -748,6 +840,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -762,7 +858,7 @@ export class MultiAssetProxyContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -771,6 +867,10 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); @@ -782,7 +882,9 @@ export class MultiAssetProxyContract extends BaseContract { getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner]); + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts index eed3604b50..76b38de9f3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -73,7 +73,7 @@ export class OrderValidatorContract extends BaseContract { const self = (this as any) as OrderValidatorContract; const encodedData = self._strictEncodeArguments( 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress], + [order, takerAddress.toLowerCase()], ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -83,6 +83,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -128,7 +132,7 @@ export class OrderValidatorContract extends BaseContract { const self = (this as any) as OrderValidatorContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress], + [order, takerAddress.toLowerCase()], ); return abiEncodedTransactionData; }, @@ -152,7 +156,7 @@ export class OrderValidatorContract extends BaseContract { } const self = (this as any) as OrderValidatorContract; const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ - target, + target.toLowerCase(), assetData, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -163,6 +167,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); @@ -176,7 +184,7 @@ export class OrderValidatorContract extends BaseContract { assert.isString('assetData', assetData); const self = (this as any) as OrderValidatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ - target, + target.toLowerCase(), assetData, ]); return abiEncodedTransactionData; @@ -239,6 +247,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -344,6 +356,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -410,7 +426,10 @@ export class OrderValidatorContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token, tokenId]); + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + token.toLowerCase(), + tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -419,6 +438,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); @@ -432,7 +455,7 @@ export class OrderValidatorContract extends BaseContract { assert.isBigNumber('tokenId', tokenId); const self = (this as any) as OrderValidatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ - token, + token.toLowerCase(), tokenId, ]); return abiEncodedTransactionData; @@ -457,7 +480,7 @@ export class OrderValidatorContract extends BaseContract { } const self = (this as any) as OrderValidatorContract; const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ - target, + target.toLowerCase(), assetData, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -468,6 +491,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); @@ -481,7 +508,7 @@ export class OrderValidatorContract extends BaseContract { assert.isArray('assetData', assetData); const self = (this as any) as OrderValidatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ - target, + target.toLowerCase(), assetData, ]); return abiEncodedTransactionData; @@ -528,7 +555,7 @@ export class OrderValidatorContract extends BaseContract { const self = (this as any) as OrderValidatorContract; const encodedData = self._strictEncodeArguments( 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress], + [order, takerAddress.toLowerCase()], ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -538,6 +565,10 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder( @@ -578,7 +609,7 @@ export class OrderValidatorContract extends BaseContract { const self = (this as any) as OrderValidatorContract; const abiEncodedTransactionData = self._strictEncodeArguments( 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress], + [order, takerAddress.toLowerCase()], ); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 28bae1aa2a..49ac1028aa 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -82,6 +82,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); @@ -101,7 +105,7 @@ export class WETH9Contract extends BaseContract { assert.isString('guy', guy); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -109,8 +113,12 @@ export class WETH9Contract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, guy, wad), + self.approve.estimateGasAsync.bind(self, guy.toLowerCase(), wad), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -124,7 +132,7 @@ export class WETH9Contract extends BaseContract { assert.isString('guy', guy); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const txHashPromise = self.approve.sendTransactionAsync(guy, wad, txData); + const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -141,7 +149,7 @@ export class WETH9Contract extends BaseContract { assert.isString('guy', guy); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -150,6 +158,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -170,7 +182,7 @@ export class WETH9Contract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -179,6 +191,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); @@ -191,7 +207,10 @@ export class WETH9Contract extends BaseContract { assert.isString('guy', guy); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad]); + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + guy.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; @@ -215,6 +234,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); @@ -240,7 +263,11 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad]); + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -248,8 +275,12 @@ export class WETH9Contract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, src, dst, wad), + self.transferFrom.estimateGasAsync.bind(self, src.toLowerCase(), dst.toLowerCase(), wad), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -265,7 +296,12 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const txHashPromise = self.transferFrom.sendTransactionAsync(src, dst, wad, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + src.toLowerCase(), + dst.toLowerCase(), + wad, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -288,7 +324,11 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad]); + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -297,6 +337,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -319,7 +363,11 @@ export class WETH9Contract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad]); + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -328,6 +376,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); @@ -342,8 +394,8 @@ export class WETH9Contract extends BaseContract { assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src, - dst, + src.toLowerCase(), + dst.toLowerCase(), wad, ]); return abiEncodedTransactionData; @@ -363,6 +415,10 @@ export class WETH9Contract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.withdraw.estimateGasAsync.bind(self, wad), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -399,6 +455,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -422,6 +482,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); @@ -457,6 +521,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); @@ -487,7 +555,7 @@ export class WETH9Contract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0]); + const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -496,6 +564,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); @@ -507,7 +579,9 @@ export class WETH9Contract extends BaseContract { getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [index_0]); + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -531,6 +605,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); @@ -550,7 +628,7 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -558,8 +636,12 @@ export class WETH9Contract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, dst, wad), + self.transfer.estimateGasAsync.bind(self, dst.toLowerCase(), wad), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -573,7 +655,7 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const txHashPromise = self.transfer.sendTransactionAsync(dst, wad, txData); + const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -590,7 +672,7 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -599,6 +681,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -619,7 +705,7 @@ export class WETH9Contract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -628,6 +714,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); @@ -640,7 +730,10 @@ export class WETH9Contract extends BaseContract { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad]); + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + dst.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; @@ -657,6 +750,10 @@ export class WETH9Contract extends BaseContract { self._web3Wrapper.getContractDefaults(), self.deposit.estimateGasAsync.bind(self), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -690,6 +787,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -712,6 +813,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('deposit()'); @@ -744,7 +849,10 @@ export class WETH9Contract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0, index_1]); + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -753,6 +861,10 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); @@ -766,8 +878,8 @@ export class WETH9Contract extends BaseContract { assert.isString('index_1', index_1); const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - index_0, - index_1, + index_0.toLowerCase(), + index_1.toLowerCase(), ]); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts index 84bd4b7586..1072cdba29 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -66,6 +66,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); @@ -89,7 +93,10 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -97,8 +104,12 @@ export class ZRXTokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender, _value), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -112,7 +123,7 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender, _value, txData); + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -133,7 +144,10 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -142,6 +156,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -162,7 +180,10 @@ export class ZRXTokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value]); + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -171,6 +192,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); @@ -184,7 +209,7 @@ export class ZRXTokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender, + _spender.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -210,6 +235,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); @@ -236,8 +265,8 @@ export class ZRXTokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -247,8 +276,12 @@ export class ZRXTokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from, _to, _value), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -264,7 +297,12 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from, _to, _value, txData); + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -288,8 +326,8 @@ export class ZRXTokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -300,6 +338,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -323,8 +365,8 @@ export class ZRXTokenContract extends BaseContract { } const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -335,6 +377,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); @@ -349,8 +395,8 @@ export class ZRXTokenContract extends BaseContract { assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from, - _to, + _from.toLowerCase(), + _to.toLowerCase(), _value, ]); return abiEncodedTransactionData; @@ -376,6 +422,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); @@ -406,7 +456,7 @@ export class ZRXTokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -415,6 +465,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); @@ -426,7 +480,7 @@ export class ZRXTokenContract extends BaseContract { getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner]); + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -450,6 +504,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); @@ -473,7 +531,7 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -481,8 +539,12 @@ export class ZRXTokenContract extends BaseContract { data: encodedData, }, self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to, _value), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -496,7 +558,7 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to, _value, txData); + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { @@ -513,7 +575,7 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -522,6 +584,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, @@ -542,7 +608,7 @@ export class ZRXTokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -551,6 +617,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); @@ -563,7 +633,10 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_to', _to); assert.isBigNumber('_value', _value); const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value]); + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -585,7 +658,10 @@ export class ZRXTokenContract extends BaseContract { assert.isBlockParam('defaultBlock', defaultBlock); } const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner, _spender]); + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -594,6 +670,10 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); @@ -607,8 +687,8 @@ export class ZRXTokenContract extends BaseContract { assert.isString('_spender', _spender); const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner, - _spender, + _owner.toLowerCase(), + _spender.toLowerCase(), ]); return abiEncodedTransactionData; }, diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index 9f09cd3fd1..41faec0d03 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -84,6 +84,10 @@ function registerTypeScriptHelpers(): void { Handlebars.registerHelper('assertionType', utils.solTypeToAssertion.bind(utils)); Handlebars.registerHelper('returnType', utils.solTypeToTsType.bind(utils, ParamKind.Output, args.backend)); + Handlebars.registerHelper('ifEquals', function(this: typeof Handlebars, arg1: any, arg2: any, options: any): void { + return arg1 === arg2 ? options.fn(this) : options.inverse(this); // tslint:disable-line:no-invalid-this + }); + // Check if 0 or false exists Handlebars.registerHelper( 'isDefined', diff --git a/packages/abi-gen/test-cli/expected-output/python/abi_gen_dummy.py b/packages/abi-gen/test-cli/expected-output/python/abi_gen_dummy.py index db6219b8c6..7215e31b3f 100644 --- a/packages/abi-gen/test-cli/expected-output/python/abi_gen_dummy.py +++ b/packages/abi-gen/test-cli/expected-output/python/abi_gen_dummy.py @@ -141,6 +141,42 @@ def require_with_constant( view_only=True ) + def with_address_input( + self, + x: str, + a: int, + b: int, + y: str, + c: int, + tx_params: Optional[TxParams] = None, + ) -> str: + """Execute underlying, same-named contract method. + + + """ + x = self._validate_and_checksum_address(x) + # safeguard against fractional inputs + a = int(a) + # safeguard against fractional inputs + b = int(b) + y = self._validate_and_checksum_address(y) + # safeguard against fractional inputs + c = int(c) + func = self._get_contract_instance( + self._contract_address + ).functions.withAddressInput( + x, + a, + b, + y, + c + ) + return self._invoke_function_call( + func=func, + tx_params=tx_params, + view_only=True + ) + def simple_pure_function_with_input( self, x: int, @@ -203,5 +239,5 @@ def pure_function_with_constant( def abi(): """Return the ABI to the underlying contract.""" return json.loads( - '[{"constant":true,"inputs":[],"name":"simpleRequire","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"hash","type":"bytes32"},{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"ecrecoverFn","outputs":[{"name":"signerAddress","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"revertWithConstant","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"simpleRevert","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"requireWithConstant","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint256"}],"name":"simplePureFunctionWithInput","outputs":[{"name":"sum","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"simplePureFunction","outputs":[{"name":"result","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"pureFunctionWithConstant","outputs":[{"name":"someConstant","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: E501 (line-too-long) + '[{"constant":true,"inputs":[],"name":"simpleRequire","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"hash","type":"bytes32"},{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"ecrecoverFn","outputs":[{"name":"signerAddress","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"revertWithConstant","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"simpleRevert","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"requireWithConstant","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"},{"name":"a","type":"uint256"},{"name":"b","type":"uint256"},{"name":"y","type":"address"},{"name":"c","type":"uint256"}],"name":"withAddressInput","outputs":[{"name":"z","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint256"}],"name":"simplePureFunctionWithInput","outputs":[{"name":"sum","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"simplePureFunction","outputs":[{"name":"result","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"pureFunctionWithConstant","outputs":[{"name":"someConstant","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: E501 (line-too-long) ) diff --git a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts index 9d036e13b1..57293155d6 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts @@ -47,6 +47,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('simpleRequire()'); @@ -97,6 +101,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ecrecoverFn(bytes32,uint8,bytes32,bytes32)'); @@ -138,6 +146,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revertWithConstant()'); @@ -172,6 +184,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('simpleRevert()'); @@ -206,6 +222,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('requireWithConstant()'); @@ -220,6 +240,68 @@ export class AbiGenDummyContract extends BaseContract { return abiEncodedTransactionData; }, }; + public withAddressInput = { + async callAsync( + x: string, + a: BigNumber, + b: BigNumber, + y: string, + c: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('x', x); + assert.isBigNumber('a', a); + assert.isBigNumber('b', b); + assert.isString('y', y); + assert.isBigNumber('c', c); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as AbiGenDummyContract; + const encodedData = self._strictEncodeArguments( + 'withAddressInput(address,uint256,uint256,address,uint256)', + [x.toLowerCase(), a, b, y.toLowerCase(), c], + ); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('withAddressInput(address,uint256,uint256,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + getABIEncodedTransactionData(x: string, a: BigNumber, b: BigNumber, y: string, c: BigNumber): string { + assert.isString('x', x); + assert.isBigNumber('a', a); + assert.isBigNumber('b', b); + assert.isString('y', y); + assert.isBigNumber('c', c); + const self = (this as any) as AbiGenDummyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'withAddressInput(address,uint256,uint256,address,uint256)', + [x.toLowerCase(), a, b, y.toLowerCase(), c], + ); + return abiEncodedTransactionData; + }, + }; public simplePureFunctionWithInput = { async callAsync(x: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isBigNumber('x', x); @@ -241,6 +323,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('simplePureFunctionWithInput(uint256)'); @@ -276,6 +362,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('simplePureFunction()'); @@ -310,6 +400,10 @@ export class AbiGenDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('pureFunctionWithConstant()'); @@ -447,6 +541,41 @@ export class AbiGenDummyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, + { + constant: true, + inputs: [ + { + name: 'x', + type: 'address', + }, + { + name: 'a', + type: 'uint256', + }, + { + name: 'b', + type: 'uint256', + }, + { + name: 'y', + type: 'address', + }, + { + name: 'c', + type: 'uint256', + }, + ], + name: 'withAddressInput', + outputs: [ + { + name: 'z', + type: 'address', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, { constant: true, inputs: [ diff --git a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts index 171ec948d4..7c192214a1 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts @@ -48,6 +48,10 @@ export class TestLibDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('publicAddConstant(uint256)'); @@ -84,6 +88,10 @@ export class TestLibDummyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('publicAddOne(uint256)'); diff --git a/packages/abi-gen/test-cli/fixtures/artifacts/AbiGenDummy.json b/packages/abi-gen/test-cli/fixtures/artifacts/AbiGenDummy.json index 357e64b1d6..09009b62bb 100644 --- a/packages/abi-gen/test-cli/fixtures/artifacts/AbiGenDummy.json +++ b/packages/abi-gen/test-cli/fixtures/artifacts/AbiGenDummy.json @@ -70,6 +70,41 @@ "stateMutability": "pure", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "name": "x", + "type": "address" + }, + { + "name": "a", + "type": "uint256" + }, + { + "name": "b", + "type": "uint256" + }, + { + "name": "y", + "type": "address" + }, + { + "name": "c", + "type": "uint256" + } + ], + "name": "withAddressInput", + "outputs": [ + { + "name": "z", + "type": "address" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, { "constant": true, "inputs": [ @@ -121,15 +156,15 @@ "evm": { "bytecode": { "linkReferences": {}, - "object": "0x608060405234801561001057600080fd5b50610550806100206000396000f3fe608060405234801561001057600080fd5b50600436106100875760003560e01c80635ba3c7c01161005b5780635ba3c7c0146101015780638ee52b4e14610109578063a3c2f6b614610138578063d88be12f1461014057610087565b806209e4371461008c57806336b32396146100965780634582eab2146100f157806345fdbdb7146100f9575b600080fd5b610094610148565b005b6100c8600480360360808110156100ac57600080fd5b5080359060ff60208201351690604081013590606001356101af565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61009461033d565b610094610411565b610094610478565b6101266004803603602081101561011f57600080fd5b503561050a565b60408051918252519081900360200190f35b610126610510565b610126610515565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f53494d504c455f52455155495245000000000000000000000000000000000000604482015290519081900360640190fd5b600060606040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509050600081876040516020018083805190602001908083835b6020831061023f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610202565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052920193845250604080518085038152848301808352815191840191909120600090915281850180835281905260ff8c166060860152608085018b905260a085018a905290519095506001945060c0808501949293507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08201928290030190855afa158015610309573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6040518060400160405280601481526020017f5245564552545f574954485f434f4e5354414e540000000000000000000000008152506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103d65781810151838201526020016103be565b50505050905090810190601f1680156104035780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f53494d504c455f52455645525400000000000000000000000000000000000000604482015290519081900360640190fd5b604080518082018252601581527f524551554952455f574954485f434f4e5354414e540000000000000000000000602080830191825292517f08c379a000000000000000000000000000000000000000000000000000000000815260048101938452825160248201528251929392839260449092019190808383600083156103d65781810151838201526020016103be565b60010190565b600190565b6104d29056fea265627a7a7230582031c41fe95fe3bee690f130baa25c4fc767579534408c83b12569d315c94cfde764736f6c634300050a0032", - "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x550 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x87 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x5BA3C7C0 GT PUSH2 0x5B JUMPI DUP1 PUSH4 0x5BA3C7C0 EQ PUSH2 0x101 JUMPI DUP1 PUSH4 0x8EE52B4E EQ PUSH2 0x109 JUMPI DUP1 PUSH4 0xA3C2F6B6 EQ PUSH2 0x138 JUMPI DUP1 PUSH4 0xD88BE12F EQ PUSH2 0x140 JUMPI PUSH2 0x87 JUMP JUMPDEST DUP1 PUSH3 0x9E437 EQ PUSH2 0x8C JUMPI DUP1 PUSH4 0x36B32396 EQ PUSH2 0x96 JUMPI DUP1 PUSH4 0x4582EAB2 EQ PUSH2 0xF1 JUMPI DUP1 PUSH4 0x45FDBDB7 EQ PUSH2 0xF9 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x94 PUSH2 0x148 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xC8 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x80 DUP2 LT ISZERO PUSH2 0xAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP1 CALLDATALOAD SWAP1 PUSH1 0xFF PUSH1 0x20 DUP3 ADD CALLDATALOAD AND SWAP1 PUSH1 0x40 DUP2 ADD CALLDATALOAD SWAP1 PUSH1 0x60 ADD CALLDATALOAD PUSH2 0x1AF JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0x94 PUSH2 0x33D JUMP JUMPDEST PUSH2 0x94 PUSH2 0x411 JUMP JUMPDEST PUSH2 0x94 PUSH2 0x478 JUMP JUMPDEST PUSH2 0x126 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x11F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x50A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0x126 PUSH2 0x510 JUMP JUMPDEST PUSH2 0x126 PUSH2 0x515 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455155495245000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x1C DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP SWAP1 POP PUSH1 0x0 DUP2 DUP8 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP4 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x23F JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x202 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE SWAP3 ADD SWAP4 DUP5 MSTORE POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP6 SUB DUP2 MSTORE DUP5 DUP4 ADD DUP1 DUP4 MSTORE DUP2 MLOAD SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x0 SWAP1 SWAP2 MSTORE DUP2 DUP6 ADD DUP1 DUP4 MSTORE DUP2 SWAP1 MSTORE PUSH1 0xFF DUP13 AND PUSH1 0x60 DUP7 ADD MSTORE PUSH1 0x80 DUP6 ADD DUP12 SWAP1 MSTORE PUSH1 0xA0 DUP6 ADD DUP11 SWAP1 MSTORE SWAP1 MLOAD SWAP1 SWAP6 POP PUSH1 0x1 SWAP5 POP PUSH1 0xC0 DUP1 DUP6 ADD SWAP5 SWAP3 SWAP4 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP3 ADD SWAP3 DUP3 SWAP1 SUB ADD SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x309 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x14 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x5245564552545F574954485F434F4E5354414E54000000000000000000000000 DUP2 MSTORE POP PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP4 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3D6 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3BE JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x403 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455645525400000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0x15 DUP2 MSTORE PUSH32 0x524551554952455F574954485F434F4E5354414E540000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 DUP3 MSTORE SWAP3 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 DUP2 ADD SWAP4 DUP5 MSTORE DUP3 MLOAD PUSH1 0x24 DUP3 ADD MSTORE DUP3 MLOAD SWAP3 SWAP4 SWAP3 DUP4 SWAP3 PUSH1 0x44 SWAP1 SWAP3 ADD SWAP2 SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 DUP4 ISZERO PUSH2 0x3D6 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3BE JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 SWAP1 JUMP JUMPDEST PUSH2 0x4D2 SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 BALANCE 0xc4 0x1f 0xe9 0x5f 0xe3 0xbe 0xe6 SWAP1 CALL ADDRESS 0xba LOG2 0x5c 0x4f 0xc7 PUSH8 0x579534408C83B125 PUSH10 0xD315C94CFDE764736F6C PUSH4 0x4300050A STOP ORIGIN ", - "sourceMap": "606:1422:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;606:1422:0;;;;;;;" + "object": "0x608060405234801561001057600080fd5b506105c3806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a25760003560e01c80635ba3c7c0116100765780638ee52b4e1161005b5780638ee52b4e14610173578063a3c2f6b6146101a2578063d88be12f146101aa576100a2565b80635ba3c7c01461011c57806363d69c8814610124576100a2565b806209e437146100a757806336b32396146100b15780634582eab21461010c57806345fdbdb714610114575b600080fd5b6100af6101b2565b005b6100e3600480360360808110156100c757600080fd5b5080359060ff6020820135169060408101359060600135610219565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100af6103a7565b6100af61047b565b6100af6104e2565b6100e3600480360360a081101561013a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359160408201359160608101359091169060800135610574565b6101906004803603602081101561018957600080fd5b503561057d565b60408051918252519081900360200190f35b610190610583565b610190610588565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f53494d504c455f52455155495245000000000000000000000000000000000000604482015290519081900360640190fd5b600060606040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509050600081876040516020018083805190602001908083835b602083106102a957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161026c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052920193845250604080518085038152848301808352815191840191909120600090915281850180835281905260ff8c166060860152608085018b905260a085018a905290519095506001945060c0808501949293507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08201928290030190855afa158015610373573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6040518060400160405280601481526020017f5245564552545f574954485f434f4e5354414e540000000000000000000000008152506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610440578181015183820152602001610428565b50505050905090810190601f16801561046d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f53494d504c455f52455645525400000000000000000000000000000000000000604482015290519081900360640190fd5b604080518082018252601581527f524551554952455f574954485f434f4e5354414e540000000000000000000000602080830191825292517f08c379a00000000000000000000000000000000000000000000000000000000081526004810193845282516024820152825192939283926044909201919080838360008315610440578181015183820152602001610428565b50929392505050565b60010190565b600190565b6104d29056fea265627a7a72305820fe29f2a571cfcbf82abb5eaa5b4e17b2bea39d36b386e88463d23d21b83c5a2364736f6c634300050a0032", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5C3 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA2 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x5BA3C7C0 GT PUSH2 0x76 JUMPI DUP1 PUSH4 0x8EE52B4E GT PUSH2 0x5B JUMPI DUP1 PUSH4 0x8EE52B4E EQ PUSH2 0x173 JUMPI DUP1 PUSH4 0xA3C2F6B6 EQ PUSH2 0x1A2 JUMPI DUP1 PUSH4 0xD88BE12F EQ PUSH2 0x1AA JUMPI PUSH2 0xA2 JUMP JUMPDEST DUP1 PUSH4 0x5BA3C7C0 EQ PUSH2 0x11C JUMPI DUP1 PUSH4 0x63D69C88 EQ PUSH2 0x124 JUMPI PUSH2 0xA2 JUMP JUMPDEST DUP1 PUSH3 0x9E437 EQ PUSH2 0xA7 JUMPI DUP1 PUSH4 0x36B32396 EQ PUSH2 0xB1 JUMPI DUP1 PUSH4 0x4582EAB2 EQ PUSH2 0x10C JUMPI DUP1 PUSH4 0x45FDBDB7 EQ PUSH2 0x114 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAF PUSH2 0x1B2 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xE3 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x80 DUP2 LT ISZERO PUSH2 0xC7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP1 CALLDATALOAD SWAP1 PUSH1 0xFF PUSH1 0x20 DUP3 ADD CALLDATALOAD AND SWAP1 PUSH1 0x40 DUP2 ADD CALLDATALOAD SWAP1 PUSH1 0x60 ADD CALLDATALOAD PUSH2 0x219 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0xAF PUSH2 0x3A7 JUMP JUMPDEST PUSH2 0xAF PUSH2 0x47B JUMP JUMPDEST PUSH2 0xAF PUSH2 0x4E2 JUMP JUMPDEST PUSH2 0xE3 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0xA0 DUP2 LT ISZERO PUSH2 0x13A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 CALLDATALOAD DUP2 AND SWAP2 PUSH1 0x20 DUP2 ADD CALLDATALOAD SWAP2 PUSH1 0x40 DUP3 ADD CALLDATALOAD SWAP2 PUSH1 0x60 DUP2 ADD CALLDATALOAD SWAP1 SWAP2 AND SWAP1 PUSH1 0x80 ADD CALLDATALOAD PUSH2 0x574 JUMP JUMPDEST PUSH2 0x190 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x189 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x57D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0x190 PUSH2 0x583 JUMP JUMPDEST PUSH2 0x190 PUSH2 0x588 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455155495245000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x1C DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP SWAP1 POP PUSH1 0x0 DUP2 DUP8 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP4 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x2A9 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x26C JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE SWAP3 ADD SWAP4 DUP5 MSTORE POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP6 SUB DUP2 MSTORE DUP5 DUP4 ADD DUP1 DUP4 MSTORE DUP2 MLOAD SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x0 SWAP1 SWAP2 MSTORE DUP2 DUP6 ADD DUP1 DUP4 MSTORE DUP2 SWAP1 MSTORE PUSH1 0xFF DUP13 AND PUSH1 0x60 DUP7 ADD MSTORE PUSH1 0x80 DUP6 ADD DUP12 SWAP1 MSTORE PUSH1 0xA0 DUP6 ADD DUP11 SWAP1 MSTORE SWAP1 MLOAD SWAP1 SWAP6 POP PUSH1 0x1 SWAP5 POP PUSH1 0xC0 DUP1 DUP6 ADD SWAP5 SWAP3 SWAP4 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP3 ADD SWAP3 DUP3 SWAP1 SUB ADD SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x373 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x14 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x5245564552545F574954485F434F4E5354414E54000000000000000000000000 DUP2 MSTORE POP PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP4 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x440 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x428 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x46D JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455645525400000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0x15 DUP2 MSTORE PUSH32 0x524551554952455F574954485F434F4E5354414E540000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 DUP3 MSTORE SWAP3 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 DUP2 ADD SWAP4 DUP5 MSTORE DUP3 MLOAD PUSH1 0x24 DUP3 ADD MSTORE DUP3 MLOAD SWAP3 SWAP4 SWAP3 DUP4 SWAP3 PUSH1 0x44 SWAP1 SWAP3 ADD SWAP2 SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 DUP4 ISZERO PUSH2 0x440 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x428 JUMP JUMPDEST POP SWAP3 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 SWAP1 JUMP JUMPDEST PUSH2 0x4D2 SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 INVALID 0x29 CALLCODE 0xa5 PUSH18 0xCFCBF82ABB5EAA5B4E17B2BEA39D36B386E8 DUP5 PUSH4 0xD23D21B8 EXTCODECOPY GAS 0x23 PUSH5 0x736F6C6343 STOP SDIV EXP STOP ORIGIN ", + "sourceMap": "606:1667:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;606:1667:0;;;;;;;" }, "deployedBytecode": { "linkReferences": {}, - "object": "0x608060405234801561001057600080fd5b50600436106100875760003560e01c80635ba3c7c01161005b5780635ba3c7c0146101015780638ee52b4e14610109578063a3c2f6b614610138578063d88be12f1461014057610087565b806209e4371461008c57806336b32396146100965780634582eab2146100f157806345fdbdb7146100f9575b600080fd5b610094610148565b005b6100c8600480360360808110156100ac57600080fd5b5080359060ff60208201351690604081013590606001356101af565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61009461033d565b610094610411565b610094610478565b6101266004803603602081101561011f57600080fd5b503561050a565b60408051918252519081900360200190f35b610126610510565b610126610515565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f53494d504c455f52455155495245000000000000000000000000000000000000604482015290519081900360640190fd5b600060606040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509050600081876040516020018083805190602001908083835b6020831061023f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610202565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052920193845250604080518085038152848301808352815191840191909120600090915281850180835281905260ff8c166060860152608085018b905260a085018a905290519095506001945060c0808501949293507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08201928290030190855afa158015610309573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6040518060400160405280601481526020017f5245564552545f574954485f434f4e5354414e540000000000000000000000008152506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103d65781810151838201526020016103be565b50505050905090810190601f1680156104035780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f53494d504c455f52455645525400000000000000000000000000000000000000604482015290519081900360640190fd5b604080518082018252601581527f524551554952455f574954485f434f4e5354414e540000000000000000000000602080830191825292517f08c379a000000000000000000000000000000000000000000000000000000000815260048101938452825160248201528251929392839260449092019190808383600083156103d65781810151838201526020016103be565b60010190565b600190565b6104d29056fea265627a7a7230582031c41fe95fe3bee690f130baa25c4fc767579534408c83b12569d315c94cfde764736f6c634300050a0032", - "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x87 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x5BA3C7C0 GT PUSH2 0x5B JUMPI DUP1 PUSH4 0x5BA3C7C0 EQ PUSH2 0x101 JUMPI DUP1 PUSH4 0x8EE52B4E EQ PUSH2 0x109 JUMPI DUP1 PUSH4 0xA3C2F6B6 EQ PUSH2 0x138 JUMPI DUP1 PUSH4 0xD88BE12F EQ PUSH2 0x140 JUMPI PUSH2 0x87 JUMP JUMPDEST DUP1 PUSH3 0x9E437 EQ PUSH2 0x8C JUMPI DUP1 PUSH4 0x36B32396 EQ PUSH2 0x96 JUMPI DUP1 PUSH4 0x4582EAB2 EQ PUSH2 0xF1 JUMPI DUP1 PUSH4 0x45FDBDB7 EQ PUSH2 0xF9 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x94 PUSH2 0x148 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xC8 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x80 DUP2 LT ISZERO PUSH2 0xAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP1 CALLDATALOAD SWAP1 PUSH1 0xFF PUSH1 0x20 DUP3 ADD CALLDATALOAD AND SWAP1 PUSH1 0x40 DUP2 ADD CALLDATALOAD SWAP1 PUSH1 0x60 ADD CALLDATALOAD PUSH2 0x1AF JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0x94 PUSH2 0x33D JUMP JUMPDEST PUSH2 0x94 PUSH2 0x411 JUMP JUMPDEST PUSH2 0x94 PUSH2 0x478 JUMP JUMPDEST PUSH2 0x126 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x11F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x50A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0x126 PUSH2 0x510 JUMP JUMPDEST PUSH2 0x126 PUSH2 0x515 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455155495245000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x1C DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP SWAP1 POP PUSH1 0x0 DUP2 DUP8 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP4 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x23F JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x202 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE SWAP3 ADD SWAP4 DUP5 MSTORE POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP6 SUB DUP2 MSTORE DUP5 DUP4 ADD DUP1 DUP4 MSTORE DUP2 MLOAD SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x0 SWAP1 SWAP2 MSTORE DUP2 DUP6 ADD DUP1 DUP4 MSTORE DUP2 SWAP1 MSTORE PUSH1 0xFF DUP13 AND PUSH1 0x60 DUP7 ADD MSTORE PUSH1 0x80 DUP6 ADD DUP12 SWAP1 MSTORE PUSH1 0xA0 DUP6 ADD DUP11 SWAP1 MSTORE SWAP1 MLOAD SWAP1 SWAP6 POP PUSH1 0x1 SWAP5 POP PUSH1 0xC0 DUP1 DUP6 ADD SWAP5 SWAP3 SWAP4 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP3 ADD SWAP3 DUP3 SWAP1 SUB ADD SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x309 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x14 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x5245564552545F574954485F434F4E5354414E54000000000000000000000000 DUP2 MSTORE POP PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP4 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3D6 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3BE JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x403 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455645525400000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0x15 DUP2 MSTORE PUSH32 0x524551554952455F574954485F434F4E5354414E540000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 DUP3 MSTORE SWAP3 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 DUP2 ADD SWAP4 DUP5 MSTORE DUP3 MLOAD PUSH1 0x24 DUP3 ADD MSTORE DUP3 MLOAD SWAP3 SWAP4 SWAP3 DUP4 SWAP3 PUSH1 0x44 SWAP1 SWAP3 ADD SWAP2 SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 DUP4 ISZERO PUSH2 0x3D6 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3BE JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 SWAP1 JUMP JUMPDEST PUSH2 0x4D2 SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 BALANCE 0xc4 0x1f 0xe9 0x5f 0xe3 0xbe 0xe6 SWAP1 CALL ADDRESS 0xba LOG2 0x5c 0x4f 0xc7 PUSH8 0x579534408C83B125 PUSH10 0xD315C94CFDE764736F6C PUSH4 0x4300050A STOP ORIGIN ", - "sourceMap": "606:1422:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;606:1422:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1461:107;;;:::i;:::-;;1691:334;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;1691:334:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1354:101;;;:::i;1251:97::-;;;:::i;1574:111::-;;;:::i;954:140::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;954:140:0;;:::i;:::-;;;;;;;;;;;;;;;;827:121;;;:::i;1100:145::-;;;:::i;1461:107::-;1529:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1691:334;1802:21;1839:19;:56;;;;;;;;;;;;;;;;;;;1905:20;1955:6;1963:4;1938:30;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;1938:30:0;;;;;-1:-1:-1;1938:30:0;;;26:21:-1;;;6:49;;1938:30:0;;;;;;1928:41;;;;;;;;;-1:-1:-1;1986:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1928:41;;-1:-1:-1;274:1;;-1:-1;1986:32:0;;;;;263:2:-1;;-1:-1;;1986:32:0;;;;;;;;274:1:-1;1986:32:0;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;1986:32:0;;;;;;1691:334;-1:-1:-1;;;;;;;;1691:334:0:o;1354:101::-;1434:13;;;;;;;;;;;;;;;;;1427:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1427:21:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1251:97;1318:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1574:111;1663:14;;;;;;;;;;;;;;;;;;;1648:30;;;;;;;;;;;;;;;;;;;1663:14;;1648:30;;;;;;;;1663:14;1648:30;;1663:14;-1:-1:-1;27:10;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;954:140:0;1082:1;:5;;954:140::o;827:121::-;940:1;827:121;:::o;1100:145::-;676:4;1100:145;:::o" + "object": "0x608060405234801561001057600080fd5b50600436106100a25760003560e01c80635ba3c7c0116100765780638ee52b4e1161005b5780638ee52b4e14610173578063a3c2f6b6146101a2578063d88be12f146101aa576100a2565b80635ba3c7c01461011c57806363d69c8814610124576100a2565b806209e437146100a757806336b32396146100b15780634582eab21461010c57806345fdbdb714610114575b600080fd5b6100af6101b2565b005b6100e3600480360360808110156100c757600080fd5b5080359060ff6020820135169060408101359060600135610219565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100af6103a7565b6100af61047b565b6100af6104e2565b6100e3600480360360a081101561013a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359160408201359160608101359091169060800135610574565b6101906004803603602081101561018957600080fd5b503561057d565b60408051918252519081900360200190f35b610190610583565b610190610588565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f53494d504c455f52455155495245000000000000000000000000000000000000604482015290519081900360640190fd5b600060606040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509050600081876040516020018083805190602001908083835b602083106102a957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161026c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052920193845250604080518085038152848301808352815191840191909120600090915281850180835281905260ff8c166060860152608085018b905260a085018a905290519095506001945060c0808501949293507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08201928290030190855afa158015610373573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6040518060400160405280601481526020017f5245564552545f574954485f434f4e5354414e540000000000000000000000008152506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610440578181015183820152602001610428565b50505050905090810190601f16801561046d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f53494d504c455f52455645525400000000000000000000000000000000000000604482015290519081900360640190fd5b604080518082018252601581527f524551554952455f574954485f434f4e5354414e540000000000000000000000602080830191825292517f08c379a00000000000000000000000000000000000000000000000000000000081526004810193845282516024820152825192939283926044909201919080838360008315610440578181015183820152602001610428565b50929392505050565b60010190565b600190565b6104d29056fea265627a7a72305820fe29f2a571cfcbf82abb5eaa5b4e17b2bea39d36b386e88463d23d21b83c5a2364736f6c634300050a0032", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA2 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x5BA3C7C0 GT PUSH2 0x76 JUMPI DUP1 PUSH4 0x8EE52B4E GT PUSH2 0x5B JUMPI DUP1 PUSH4 0x8EE52B4E EQ PUSH2 0x173 JUMPI DUP1 PUSH4 0xA3C2F6B6 EQ PUSH2 0x1A2 JUMPI DUP1 PUSH4 0xD88BE12F EQ PUSH2 0x1AA JUMPI PUSH2 0xA2 JUMP JUMPDEST DUP1 PUSH4 0x5BA3C7C0 EQ PUSH2 0x11C JUMPI DUP1 PUSH4 0x63D69C88 EQ PUSH2 0x124 JUMPI PUSH2 0xA2 JUMP JUMPDEST DUP1 PUSH3 0x9E437 EQ PUSH2 0xA7 JUMPI DUP1 PUSH4 0x36B32396 EQ PUSH2 0xB1 JUMPI DUP1 PUSH4 0x4582EAB2 EQ PUSH2 0x10C JUMPI DUP1 PUSH4 0x45FDBDB7 EQ PUSH2 0x114 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAF PUSH2 0x1B2 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xE3 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x80 DUP2 LT ISZERO PUSH2 0xC7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP1 CALLDATALOAD SWAP1 PUSH1 0xFF PUSH1 0x20 DUP3 ADD CALLDATALOAD AND SWAP1 PUSH1 0x40 DUP2 ADD CALLDATALOAD SWAP1 PUSH1 0x60 ADD CALLDATALOAD PUSH2 0x219 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0xAF PUSH2 0x3A7 JUMP JUMPDEST PUSH2 0xAF PUSH2 0x47B JUMP JUMPDEST PUSH2 0xAF PUSH2 0x4E2 JUMP JUMPDEST PUSH2 0xE3 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0xA0 DUP2 LT ISZERO PUSH2 0x13A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 CALLDATALOAD DUP2 AND SWAP2 PUSH1 0x20 DUP2 ADD CALLDATALOAD SWAP2 PUSH1 0x40 DUP3 ADD CALLDATALOAD SWAP2 PUSH1 0x60 DUP2 ADD CALLDATALOAD SWAP1 SWAP2 AND SWAP1 PUSH1 0x80 ADD CALLDATALOAD PUSH2 0x574 JUMP JUMPDEST PUSH2 0x190 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x189 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH2 0x57D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH2 0x190 PUSH2 0x583 JUMP JUMPDEST PUSH2 0x190 PUSH2 0x588 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455155495245000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x1C DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP SWAP1 POP PUSH1 0x0 DUP2 DUP8 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP4 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x2A9 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x26C JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE SWAP3 ADD SWAP4 DUP5 MSTORE POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP6 SUB DUP2 MSTORE DUP5 DUP4 ADD DUP1 DUP4 MSTORE DUP2 MLOAD SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x0 SWAP1 SWAP2 MSTORE DUP2 DUP6 ADD DUP1 DUP4 MSTORE DUP2 SWAP1 MSTORE PUSH1 0xFF DUP13 AND PUSH1 0x60 DUP7 ADD MSTORE PUSH1 0x80 DUP6 ADD DUP12 SWAP1 MSTORE PUSH1 0xA0 DUP6 ADD DUP11 SWAP1 MSTORE SWAP1 MLOAD SWAP1 SWAP6 POP PUSH1 0x1 SWAP5 POP PUSH1 0xC0 DUP1 DUP6 ADD SWAP5 SWAP3 SWAP4 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP3 ADD SWAP3 DUP3 SWAP1 SUB ADD SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x373 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x14 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x5245564552545F574954485F434F4E5354414E54000000000000000000000000 DUP2 MSTORE POP PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP4 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x440 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x428 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x46D JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x53494D504C455F52455645525400000000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0x15 DUP2 MSTORE PUSH32 0x524551554952455F574954485F434F4E5354414E540000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 DUP3 MSTORE SWAP3 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 DUP2 ADD SWAP4 DUP5 MSTORE DUP3 MLOAD PUSH1 0x24 DUP3 ADD MSTORE DUP3 MLOAD SWAP3 SWAP4 SWAP3 DUP4 SWAP3 PUSH1 0x44 SWAP1 SWAP3 ADD SWAP2 SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 DUP4 ISZERO PUSH2 0x440 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x428 JUMP JUMPDEST POP SWAP3 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 SWAP1 JUMP JUMPDEST PUSH2 0x4D2 SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 INVALID 0x29 CALLCODE 0xa5 PUSH18 0xCFCBF82ABB5EAA5B4E17B2BEA39D36B386E8 DUP5 PUSH4 0xD23D21B8 EXTCODECOPY GAS 0x23 PUSH5 0x736F6C6343 STOP SDIV EXP STOP ORIGIN ", + "sourceMap": "606:1667:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;606:1667:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1461:107;;;:::i;:::-;;1691:334;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;1691:334:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1354:101;;;:::i;1251:97::-;;;:::i;1574:111::-;;;:::i;2104:166::-;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;2104:166:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;954:140::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;954:140:0;;:::i;:::-;;;;;;;;;;;;;;;;827:121;;;:::i;1100:145::-;;;:::i;1461:107::-;1529:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1691:334;1802:21;1839:19;:56;;;;;;;;;;;;;;;;;;;1905:20;1955:6;1963:4;1938:30;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;1938:30:0;;;;;-1:-1:-1;1938:30:0;;;26:21:-1;;;6:49;;1938:30:0;;;;;;1928:41;;;;;;;;;-1:-1:-1;1986:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1928:41;;-1:-1:-1;274:1;;-1:-1;1986:32:0;;;;;263:2:-1;;-1:-1;;1986:32:0;;;;;;;;274:1:-1;1986:32:0;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;1986:32:0;;;;;;1691:334;-1:-1:-1;;;;;;;;1691:334:0:o;1354:101::-;1434:13;;;;;;;;;;;;;;;;;1427:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1427:21:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1251:97;1318:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1574:111;1663:14;;;;;;;;;;;;;;;;;;;1648:30;;;;;;;;;;;;;;;;;;;1663:14;;1648:30;;;;;;;;1663:14;1648:30;;1663:14;-1:-1:-1;27:10;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;2104:166:0;-1:-1:-1;2262:1:0;;2104:166;-1:-1:-1;;;2104:166:0:o;954:140::-;1082:1;:5;;954:140::o;827:121::-;940:1;827:121;:::o;1100:145::-;676:4;1100:145;:::o" } } }, @@ -139,9 +174,9 @@ } }, "sourceCodes": { - "AbiGenDummy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\n\ncontract AbiGenDummy\n{\n\n uint256 constant internal SOME_CONSTANT = 1234;\n string constant internal REVERT_REASON = \"REVERT_WITH_CONSTANT\";\n string constant internal REQUIRE_REASON = \"REQUIRE_WITH_CONSTANT\";\n\n function simplePureFunction ()\n public\n pure\n returns (uint256 result)\n {\n return 1;\n }\n\n function simplePureFunctionWithInput (uint256 x)\n public\n pure\n returns (uint256 sum)\n {\n return 1 + x;\n }\n\n function pureFunctionWithConstant ()\n public\n pure\n returns (uint256 someConstant)\n {\n return SOME_CONSTANT;\n }\n\n function simpleRevert ()\n public\n pure\n {\n revert(\"SIMPLE_REVERT\");\n }\n\n function revertWithConstant ()\n public\n pure\n {\n revert(REVERT_REASON);\n }\n\n function simpleRequire ()\n public\n pure\n {\n require(0 > 1, \"SIMPLE_REQUIRE\");\n }\n\n function requireWithConstant ()\n public\n pure\n {\n require(0 > 1, REQUIRE_REASON);\n }\n\n function ecrecoverFn(bytes32 hash, uint8 v, bytes32 r, bytes32 s)\n public\n pure\n returns (address signerAddress)\n {\n bytes memory prefix = \"\\x19Ethereum Signed Message:\\n32\";\n bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, hash));\n return ecrecover(prefixedHash, v, r, s);\n }\n\n}\n" + "AbiGenDummy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\n\ncontract AbiGenDummy\n{\n\n uint256 constant internal SOME_CONSTANT = 1234;\n string constant internal REVERT_REASON = \"REVERT_WITH_CONSTANT\";\n string constant internal REQUIRE_REASON = \"REQUIRE_WITH_CONSTANT\";\n\n function simplePureFunction ()\n public\n pure\n returns (uint256 result)\n {\n return 1;\n }\n\n function simplePureFunctionWithInput (uint256 x)\n public\n pure\n returns (uint256 sum)\n {\n return 1 + x;\n }\n\n function pureFunctionWithConstant ()\n public\n pure\n returns (uint256 someConstant)\n {\n return SOME_CONSTANT;\n }\n\n function simpleRevert ()\n public\n pure\n {\n revert(\"SIMPLE_REVERT\");\n }\n\n function revertWithConstant ()\n public\n pure\n {\n revert(REVERT_REASON);\n }\n\n function simpleRequire ()\n public\n pure\n {\n require(0 > 1, \"SIMPLE_REQUIRE\");\n }\n\n function requireWithConstant ()\n public\n pure\n {\n require(0 > 1, REQUIRE_REASON);\n }\n\n function ecrecoverFn(bytes32 hash, uint8 v, bytes32 r, bytes32 s)\n public\n pure\n returns (address signerAddress)\n {\n bytes memory prefix = \"\\x19Ethereum Signed Message:\\n32\";\n bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, hash));\n return ecrecover(prefixedHash, v, r, s);\n }\n\n // test: generated code should normalize address inputs to lowercase\n function withAddressInput(address x, uint256 a, uint256 b, address y, uint256 c)\n public\n pure\n returns (address z)\n {\n return x;\n }\n\n}\n" }, - "sourceTreeHashHex": "0xa9aab98d0afd82b6d05acf4e76b14fd54a5a28c9b3adc2eb21b7a64d434adfd5", + "sourceTreeHashHex": "0x0b6cc8d8d854c5af8d62214c19140c45ab98691b4d3074cd164e32158a1185b7", "compiler": { "name": "solc", "version": "soljson-v0.5.10+commit.5a6ea5b1.js", diff --git a/packages/abi-gen/test-cli/fixtures/contracts/AbiGenDummy.sol b/packages/abi-gen/test-cli/fixtures/contracts/AbiGenDummy.sol index 05c1660ef1..1c64410845 100644 --- a/packages/abi-gen/test-cli/fixtures/contracts/AbiGenDummy.sol +++ b/packages/abi-gen/test-cli/fixtures/contracts/AbiGenDummy.sol @@ -88,4 +88,14 @@ contract AbiGenDummy return ecrecover(prefixedHash, v, r, s); } + // test: generated code should normalize address inputs to lowercase + // add extra inputs to make sure it works with address in any position + function withAddressInput(address x, uint256 a, uint256 b, address y, uint256 c) + public + pure + returns (address z) + { + return x; + } + } diff --git a/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts b/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts index ea4c614750..ec12d5c55a 100644 --- a/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts +++ b/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts @@ -91,6 +91,19 @@ describe('AbiGenDummy Contract', () => { expect(result).to.equal(signerAddress); }); }); + + describe('withAddressInput', () => { + it('should normalize address inputs to lowercase', async () => { + const xAddress = devConstants.TESTRPC_FIRST_ADDRESS.toUpperCase(); + const yAddress = devConstants.TESTRPC_FIRST_ADDRESS; + const a = new BigNumber(1); + const b = new BigNumber(2); + const c = new BigNumber(3); + const output = await abiGenDummy.withAddressInput.callAsync(xAddress, a, b, yAddress, c); + + expect(output).to.equal(xAddress.toLowerCase()); + }); + }); }); describe('Lib dummy contract', () => { From bf0d90d07977b62610b3e327ac739af39743c309 Mon Sep 17 00:00:00 2001 From: David Sun Date: Wed, 17 Jul 2019 11:56:27 -0700 Subject: [PATCH 15/18] added options, features for asset-swapper --- packages/asset-swapper/src/constants.ts | 7 ++++ packages/asset-swapper/src/index.ts | 2 ++ .../exchange_swap_quote_consumer.ts | 7 ++-- .../forwarder_swap_quote_consumer.ts | 20 +++++++---- .../quote_consumers/swap_quote_consumer.ts | 25 ++++++++----- packages/asset-swapper/src/swap_quoter.ts | 6 ++-- packages/asset-swapper/src/types.ts | 10 ++++++ .../src/utils/swap_quote_calculator.ts | 15 ++++++-- .../src/utils/swap_quote_utils.ts | 36 +++++++++++++++++++ 9 files changed, 106 insertions(+), 22 deletions(-) create mode 100644 packages/asset-swapper/src/utils/swap_quote_utils.ts diff --git a/packages/asset-swapper/src/constants.ts b/packages/asset-swapper/src/constants.ts index 9eb37228f3..463e49666e 100644 --- a/packages/asset-swapper/src/constants.ts +++ b/packages/asset-swapper/src/constants.ts @@ -8,6 +8,7 @@ import { OrdersAndFillableAmounts, SwapQuoteRequestOpts, SwapQuoterOpts, + SwapQuoteUtilsOpts, } from './types'; const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; @@ -21,6 +22,10 @@ const DEFAULT_SWAP_QUOTER_OPTS: SwapQuoterOpts = { expiryBufferMs: 120000, // 2 minutes }; +const DEFAULT_SWAP_QUOTE_UTILS_OPTS: SwapQuoteUtilsOpts = { + networkId: MAINNET_NETWORK_ID, +}; + const DEFAULT_FORWARDER_SWAP_QUOTE_GET_OPTS: ForwarderSwapQuoteGetOutputOpts = { feePercentage: 0, feeRecipient: NULL_ADDRESS, @@ -30,6 +35,7 @@ const DEFAULT_FORWARDER_SWAP_QUOTE_EXECUTE_OPTS: ForwarderSwapQuoteExecutionOpts const DEFAULT_SWAP_QUOTE_REQUEST_OPTS: SwapQuoteRequestOpts = { shouldForceOrderRefresh: false, + shouldDisableRequestingFeeOrders: false, slippagePercentage: 0.2, // 20% slippage protection, }; @@ -56,4 +62,5 @@ export const constants = { EMPTY_ORDERS_AND_FILLABLE_AMOUNTS, DEFAULT_PER_PAGE, DEFAULT_LIQUIDITY_REQUEST_OPTS, + DEFAULT_SWAP_QUOTE_UTILS_OPTS, }; diff --git a/packages/asset-swapper/src/index.ts b/packages/asset-swapper/src/index.ts index 3321fff960..f6de50303e 100644 --- a/packages/asset-swapper/src/index.ts +++ b/packages/asset-swapper/src/index.ts @@ -23,6 +23,7 @@ export { export { SignedOrder } from '@0x/types'; export { BigNumber } from '@0x/utils'; +export { SwapQuoteUtils } from './utils/swap_quote_utils'; export { SwapQuoteConsumer } from './quote_consumers/swap_quote_consumer'; export { SwapQuoter } from './swap_quoter'; export { InsufficientAssetLiquidityError } from './errors'; @@ -33,6 +34,7 @@ export { StandardRelayerAPIOrderProvider } from './order_providers/standard_rela export { SwapQuoterError, SwapQuoterOpts, + SwapQuoteUtilsOpts, SwapQuote, SwapQuoteConsumerOpts, CalldataInfo, diff --git a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts index 140d6ee856..a006df8f8a 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts @@ -1,4 +1,5 @@ import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers'; +import { calldataOptimizationUtils } from '@0x/contract-wrappers/src/utils/calldata_optimization_utils'; import { MarketOperation } from '@0x/types'; import { AbiEncoder, providerUtils } from '@0x/utils'; import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; @@ -75,6 +76,8 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature); let params: ExchangeSmartContractParams; @@ -84,7 +87,7 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature); const feeSignatures = _.map(feeOrders, o => o.signature); @@ -113,25 +121,25 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase, ): Promise> { - return swapQuoteConsumerUtils.getConsumerForSwapQuoteAsync( - quote, - this._contractWrappers, - this.provider, - this._exchangeConsumer, - this._forwarderConsumer, - opts, - ); - } + if (opts.useConsumerType === ConsumerType.Exchange) { + return this._exchangeConsumer; + } else if (opts.useConsumerType === ConsumerType.Forwarder) { + return this._forwarderConsumer; + } else { + return swapQuoteConsumerUtils.getConsumerForSwapQuoteAsync( + quote, + this._contractWrappers, + this.provider, + this._exchangeConsumer, + this._forwarderConsumer, + opts, + ); + } + } } diff --git a/packages/asset-swapper/src/swap_quoter.ts b/packages/asset-swapper/src/swap_quoter.ts index 139743ab60..b8cb75efc7 100644 --- a/packages/asset-swapper/src/swap_quoter.ts +++ b/packages/asset-swapper/src/swap_quoter.ts @@ -391,7 +391,7 @@ export class SwapQuoter { marketOperation: MarketOperation, options: Partial, ): Promise { - const { shouldForceOrderRefresh, slippagePercentage } = _.merge( + const { shouldForceOrderRefresh, slippagePercentage, shouldDisableRequestingFeeOrders } = _.merge( {}, constants.DEFAULT_SWAP_QUOTE_REQUEST_OPTS, options, @@ -406,7 +406,7 @@ export class SwapQuoter { // if the requested assetData is ZRX, don't get the fee info const [ordersAndFillableAmounts, feeOrdersAndFillableAmounts] = await Promise.all([ this.getOrdersAndFillableAmountsAsync(makerAssetData, takerAssetData, shouldForceOrderRefresh), - isMakerAssetZrxToken + shouldDisableRequestingFeeOrders || isMakerAssetZrxToken ? Promise.resolve(constants.EMPTY_ORDERS_AND_FILLABLE_AMOUNTS) : this.getOrdersAndFillableAmountsAsync(zrxTokenAssetData, takerAssetData, shouldForceOrderRefresh), shouldForceOrderRefresh, @@ -429,6 +429,7 @@ export class SwapQuoter { assetFillAmount, slippagePercentage, isMakerAssetZrxToken, + shouldDisableRequestingFeeOrders, ); } else { swapQuote = swapQuoteCalculator.calculateMarketSellSwapQuote( @@ -437,6 +438,7 @@ export class SwapQuoter { assetFillAmount, slippagePercentage, isMakerAssetZrxToken, + shouldDisableRequestingFeeOrders, ); } diff --git a/packages/asset-swapper/src/types.ts b/packages/asset-swapper/src/types.ts index fb68163910..8483fdf88e 100644 --- a/packages/asset-swapper/src/types.ts +++ b/packages/asset-swapper/src/types.ts @@ -94,6 +94,10 @@ export interface ExchangeMarketSellSmartContractParams extends SmartContractPara type: MarketOperation.Sell; } +export enum ConsumerType { + Forwarder, Exchange, +} + /** * Represents all the parameters to interface with 0x exchange contracts' marketSell and marketBuy functions. */ @@ -157,6 +161,10 @@ export interface SwapQuoteConsumerOpts { networkId: number; } +export interface SwapQuoteUtilsOpts { + networkId: number; +} + /** * Represents the options provided to a generic SwapQuoteConsumer */ @@ -198,6 +206,7 @@ export type SwapQuote = MarketBuySwapQuote | MarketSellSwapQuote; */ export interface SwapQuoteGetOutputOpts extends ForwarderSwapQuoteGetOutputOpts { takerAddress?: string; + useConsumerType?: ConsumerType; } /** @@ -262,6 +271,7 @@ export interface SwapQuoteInfo { */ export interface SwapQuoteRequestOpts { shouldForceOrderRefresh: boolean; + shouldDisableRequestingFeeOrders: boolean; slippagePercentage: number; } diff --git a/packages/asset-swapper/src/utils/swap_quote_calculator.ts b/packages/asset-swapper/src/utils/swap_quote_calculator.ts index 4cc0607337..728ebe2f9f 100644 --- a/packages/asset-swapper/src/utils/swap_quote_calculator.ts +++ b/packages/asset-swapper/src/utils/swap_quote_calculator.ts @@ -22,6 +22,7 @@ export const swapQuoteCalculator = { takerAssetFillAmount: BigNumber, slippagePercentage: number, isMakerAssetZrxToken: boolean, + shouldDisableFeeOrderCalculations: boolean, ): MarketSellSwapQuote { return calculateSwapQuote( ordersAndFillableAmounts, @@ -29,7 +30,9 @@ export const swapQuoteCalculator = { takerAssetFillAmount, slippagePercentage, isMakerAssetZrxToken, + shouldDisableFeeOrderCalculations, MarketOperation.Sell, + ) as MarketSellSwapQuote; }, calculateMarketBuySwapQuote( @@ -38,6 +41,7 @@ export const swapQuoteCalculator = { makerAssetFillAmount: BigNumber, slippagePercentage: number, isMakerAssetZrxToken: boolean, + shouldDisableFeeOrderCalculations: boolean, ): MarketBuySwapQuote { return calculateSwapQuote( ordersAndFillableAmounts, @@ -45,6 +49,7 @@ export const swapQuoteCalculator = { makerAssetFillAmount, slippagePercentage, isMakerAssetZrxToken, + shouldDisableFeeOrderCalculations, MarketOperation.Buy, ) as MarketBuySwapQuote; }, @@ -56,6 +61,7 @@ function calculateSwapQuote( assetFillAmount: BigNumber, slippagePercentage: number, isMakerAssetZrxToken: boolean, + shouldDisableFeeOrderCalculations: boolean, marketOperation: MarketOperation, ): SwapQuote { const orders = ordersAndFillableAmounts.orders; @@ -128,7 +134,7 @@ function calculateSwapQuote( // finding order that cover all fees, this will help with estimating ETH and minimizing gas usage let resultFeeOrders = [] as SignedOrder[]; let feeOrdersRemainingFillableMakerAssetAmounts = [] as BigNumber[]; - if (!isMakerAssetZrxToken) { + if (!shouldDisableFeeOrderCalculations && !isMakerAssetZrxToken) { const feeOrdersAndRemainingFeeAmount = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( resultOrders, feeOrders, @@ -165,6 +171,7 @@ function calculateSwapQuote( trimmedFeeOrdersAndFillableAmounts, assetFillAmount, isMakerAssetZrxToken, + shouldDisableFeeOrderCalculations, marketOperation, ); // in order to calculate the maxRate, reverse the ordersAndFillableAmounts such that they are sorted from worst rate to best rate @@ -173,6 +180,7 @@ function calculateSwapQuote( reverseOrdersAndFillableAmounts(trimmedFeeOrdersAndFillableAmounts), assetFillAmount, isMakerAssetZrxToken, + shouldDisableFeeOrderCalculations, marketOperation, ); @@ -205,6 +213,7 @@ function calculateQuoteInfo( feeOrdersAndFillableAmounts: OrdersAndFillableAmounts, tokenAmount: BigNumber, isMakerAssetZrxToken: boolean, + shouldDisableFeeOrderCalculations: boolean, marketOperation: MarketOperation, ): SwapQuoteInfo { // find the total eth and zrx needed to buy assetAmount from the resultOrders from left to right @@ -212,7 +221,7 @@ function calculateQuoteInfo( let takerTokenAmount = marketOperation === MarketOperation.Sell ? tokenAmount : constants.ZERO_AMOUNT; let zrxTakerTokenAmount = constants.ZERO_AMOUNT; - if (isMakerAssetZrxToken) { + if (!shouldDisableFeeOrderCalculations && isMakerAssetZrxToken) { if (marketOperation === MarketOperation.Buy) { takerTokenAmount = findTakerTokenAmountNeededToBuyZrx(ordersAndFillableAmounts, makerTokenAmount); } else { @@ -221,7 +230,7 @@ function calculateQuoteInfo( takerTokenAmount, ); } - } else { + } else if (!shouldDisableFeeOrderCalculations) { const findTokenAndZrxAmount = marketOperation === MarketOperation.Buy ? findTakerTokenAndZrxAmountNeededToBuyAsset diff --git a/packages/asset-swapper/src/utils/swap_quote_utils.ts b/packages/asset-swapper/src/utils/swap_quote_utils.ts new file mode 100644 index 0000000000..3c2f05323a --- /dev/null +++ b/packages/asset-swapper/src/utils/swap_quote_utils.ts @@ -0,0 +1,36 @@ +import { ContractWrappers, SupportedProvider, ZeroExProvider } from '@0x/contract-wrappers'; +import { providerUtils } from '@0x/utils'; +import * as _ from 'lodash'; + +import { constants } from '../constants'; +import { SwapQuote, SwapQuoteUtilsOpts } from '../types'; +import { assert } from '../utils/assert'; + +export class SwapQuoteUtils { + public readonly provider: ZeroExProvider; + public readonly networkId: number; + + private readonly _contractWrappers: ContractWrappers; + + constructor(supportedProvider: SupportedProvider, options: Partial = {}) { + const { networkId } = _.merge({}, constants.DEFAULT_SWAP_QUOTE_UTILS_OPTS, options); + assert.isNumber('networkId', networkId); + + const provider = providerUtils.standardizeOrThrow(supportedProvider); + this.provider = provider; + this.networkId = networkId; + this._contractWrappers = new ContractWrappers(this.provider, { + networkId, + }); + + } + + public async isTakerAddressAllowanceEnoughForBestAndWorstQuoteInfoAsync(swapQuote: SwapQuote, takerAddress: string): Promise<[boolean, boolean]> { + const orderValidatorWrapper = this._contractWrappers.orderValidator; + const balanceAndAllowance = await orderValidatorWrapper.getBalanceAndAllowanceAsync(takerAddress, swapQuote.takerAssetData); + return [ + balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.bestCaseQuoteInfo.totalTakerTokenAmount), + balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.worstCaseQuoteInfo.totalTakerTokenAmount), + ]; + } +} From 88ff38eca658db6abc8f77bc11378ffa489ffa20 Mon Sep 17 00:00:00 2001 From: David Sun Date: Wed, 17 Jul 2019 13:38:30 -0700 Subject: [PATCH 16/18] fixed build issues --- .../exchange_swap_quote_consumer.ts | 2 +- .../forwarder_swap_quote_consumer.ts | 3 +-- .../quote_consumers/swap_quote_consumer.ts | 2 +- packages/asset-swapper/src/types.ts | 3 ++- .../src/utils/swap_quote_calculator.ts | 1 - .../src/utils/swap_quote_utils.ts | 11 +++++++--- .../test/swap_quote_calculator_test.ts | 22 +++++++++++++++++++ 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts index a006df8f8a..23d26dfdcd 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts @@ -1,5 +1,5 @@ import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers'; -import { calldataOptimizationUtils } from '@0x/contract-wrappers/src/utils/calldata_optimization_utils'; +import { calldataOptimizationUtils } from '@0x/contract-wrappers/lib/src/utils/calldata_optimization_utils'; import { MarketOperation } from '@0x/types'; import { AbiEncoder, providerUtils } from '@0x/utils'; import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; diff --git a/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts index ba860132a0..45b6a75e43 100644 --- a/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts @@ -1,12 +1,11 @@ import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers'; -import { calldataOptimizationUtils } from '@0x/contract-wrappers/src/utils/calldata_optimization_utils'; +import { calldataOptimizationUtils } from '@0x/contract-wrappers/lib/src/utils/calldata_optimization_utils'; import { MarketOperation } from '@0x/types'; import { AbiEncoder, providerUtils } from '@0x/utils'; import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; import { MethodAbi } from 'ethereum-types'; import * as _ from 'lodash'; - import { constants } from '../constants'; import { CalldataInfo, diff --git a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts index 5035464dab..9e388613d1 100644 --- a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts @@ -89,5 +89,5 @@ export class SwapQuoteConsumer implements SwapQuoteConsumerBase { + public async isTakerAddressAllowanceEnoughForBestAndWorstQuoteInfoAsync( + swapQuote: SwapQuote, + takerAddress: string, + ): Promise<[boolean, boolean]> { const orderValidatorWrapper = this._contractWrappers.orderValidator; - const balanceAndAllowance = await orderValidatorWrapper.getBalanceAndAllowanceAsync(takerAddress, swapQuote.takerAssetData); + const balanceAndAllowance = await orderValidatorWrapper.getBalanceAndAllowanceAsync( + takerAddress, + swapQuote.takerAssetData, + ); return [ balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.bestCaseQuoteInfo.totalTakerTokenAmount), balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.worstCaseQuoteInfo.totalTakerTokenAmount), diff --git a/packages/asset-swapper/test/swap_quote_calculator_test.ts b/packages/asset-swapper/test/swap_quote_calculator_test.ts index 7481c7181d..c120a2c1b6 100644 --- a/packages/asset-swapper/test/swap_quote_calculator_test.ts +++ b/packages/asset-swapper/test/swap_quote_calculator_test.ts @@ -78,6 +78,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(200), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(150)); @@ -91,6 +92,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(200), 0.2, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(125)); @@ -104,6 +106,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(200), 0.05, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(142)); @@ -121,6 +124,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(51), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(50)); @@ -142,6 +146,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(81), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(80)); @@ -159,6 +164,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(100), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(1)); @@ -176,6 +182,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(100), 0.2, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(0)); @@ -189,6 +196,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(125), 0, false, + false, ), ).to.not.throw(); }); @@ -201,6 +209,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(125), 0, false, + false, ), ).to.throw(SwapQuoterError.InsufficientZrxLiquidity); }); @@ -215,6 +224,7 @@ describe('swapQuoteCalculator', () => { assetSellAmount, slippagePercentage, false, + false, ); // test if orders are correct expect(swapQuote.orders).to.deep.equal([ordersAndFillableAmounts.orders[0]]); @@ -258,6 +268,7 @@ describe('swapQuoteCalculator', () => { assetSellAmount, slippagePercentage, false, + false, ); // test if orders are correct expect(swapQuote.orders).to.deep.equal(ordersAndFillableAmounts.orders); @@ -352,6 +363,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(500), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(400)); @@ -365,6 +377,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(500), 0.2, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(333)); @@ -378,6 +391,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(600), 0.05, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(380)); @@ -395,6 +409,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(201), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(200)); @@ -416,6 +431,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(124), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(123)); @@ -433,6 +449,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(600), 0, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(1)); @@ -450,6 +467,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(600), 0.2, false, + false, ); }; testHelpers.expectInsufficientLiquidityError(expect, errorFunction, new BigNumber(0)); @@ -463,6 +481,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(300), 0, false, + false, ), ).to.not.throw(); }); @@ -475,6 +494,7 @@ describe('swapQuoteCalculator', () => { new BigNumber(300), 0, false, + false, ), ).to.throw(SwapQuoterError.InsufficientZrxLiquidity); }); @@ -489,6 +509,7 @@ describe('swapQuoteCalculator', () => { assetBuyAmount, slippagePercentage, false, + false, ); // test if orders are correct expect(swapQuote.orders).to.deep.equal([ordersAndFillableAmounts.orders[0]]); @@ -532,6 +553,7 @@ describe('swapQuoteCalculator', () => { assetBuyAmount, slippagePercentage, false, + false, ); // test if orders are correct expect(swapQuote.orders).to.deep.equal(ordersAndFillableAmounts.orders); From dcf4eb2aaff70a5ed8123ce1e7a4007f2dfc658e Mon Sep 17 00:00:00 2001 From: David Sun Date: Wed, 17 Jul 2019 15:12:59 -0700 Subject: [PATCH 17/18] utils moved to SwapQuoter and polished Doc Strings --- packages/asset-swapper/src/index.ts | 1 - .../exchange_swap_quote_consumer.ts | 6 +-- packages/asset-swapper/src/swap_quoter.ts | 15 +++++++ packages/asset-swapper/src/types.ts | 37 +++++++++-------- .../src/utils/swap_quote_utils.ts | 41 ------------------- 5 files changed, 36 insertions(+), 64 deletions(-) delete mode 100644 packages/asset-swapper/src/utils/swap_quote_utils.ts diff --git a/packages/asset-swapper/src/index.ts b/packages/asset-swapper/src/index.ts index f6de50303e..af5ab2c12a 100644 --- a/packages/asset-swapper/src/index.ts +++ b/packages/asset-swapper/src/index.ts @@ -23,7 +23,6 @@ export { export { SignedOrder } from '@0x/types'; export { BigNumber } from '@0x/utils'; -export { SwapQuoteUtils } from './utils/swap_quote_utils'; export { SwapQuoteConsumer } from './quote_consumers/swap_quote_consumer'; export { SwapQuoter } from './swap_quoter'; export { InsufficientAssetLiquidityError } from './errors'; diff --git a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts index 23d26dfdcd..a88b383310 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts @@ -76,8 +76,6 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature); let params: ExchangeSmartContractParams; @@ -87,7 +85,7 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase { + const orderValidatorWrapper = this._contractWrappers.orderValidator; + const balanceAndAllowance = await orderValidatorWrapper.getBalanceAndAllowanceAsync( + takerAddress, + swapQuote.takerAssetData, + ); + return [ + balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.bestCaseQuoteInfo.totalTakerTokenAmount), + balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.worstCaseQuoteInfo.totalTakerTokenAmount), + ]; + } + /** * Get the assetData that represents the ZRX token. * Will throw if ZRX does not exist for the current network. diff --git a/packages/asset-swapper/src/types.ts b/packages/asset-swapper/src/types.ts index d3ec592da2..0d76d285c9 100644 --- a/packages/asset-swapper/src/types.ts +++ b/packages/asset-swapper/src/types.ts @@ -94,9 +94,11 @@ export interface ExchangeMarketSellSmartContractParams extends SmartContractPara type: MarketOperation.Sell; } +/** + * Represents the varying smart contracts that can consume a valid swap quote + */ export enum ConsumerType { - Forwarder, - Exchange, + Forwarder, Exchange, } /** @@ -162,10 +164,6 @@ export interface SwapQuoteConsumerOpts { networkId: number; } -export interface SwapQuoteUtilsOpts { - networkId: number; -} - /** * Represents the options provided to a generic SwapQuoteConsumer */ @@ -193,34 +191,27 @@ export interface ForwarderSwapQuoteGetOutputOpts extends SwapQuoteGetOutputOptsB ethAmount?: BigNumber; } -/** - * Represents the options for executing a swap quote with ForwarderSwapQuoteConusmer - */ -export interface ForwarderSwapQuoteExecutionOpts extends ForwarderSwapQuoteGetOutputOpts, SwapQuoteExecutionOptsBase {} - export type SwapQuote = MarketBuySwapQuote | MarketSellSwapQuote; /** - * feePercentage: percentage (up to 5%) of the taker asset paid to feeRecipient - * feeRecipient: address of the receiver of the feePercentage of taker asset - * ethAmount: The amount of eth (in Wei) sent to the forwarder contract. + * takerAddress: The address to perform the buy. Defaults to the first available address from the provider. + * useConsumerType: If provided, defaults the SwapQuoteConsumer to create output consumed by ConsumerType. */ export interface SwapQuoteGetOutputOpts extends ForwarderSwapQuoteGetOutputOpts { takerAddress?: string; useConsumerType?: ConsumerType; } -/** - * Represents the options for executing a swap quote with ForwarderSwapQuoteConusmer - */ export interface ForwarderSwapQuoteExecutionOpts extends ForwarderSwapQuoteGetOutputOpts, SwapQuoteExecutionOptsBase {} +/** + * Represents the options for executing a swap quote with SwapQuoteConsumer + */ export interface SwapQuoteExecutionOpts extends SwapQuoteGetOutputOpts, ForwarderSwapQuoteExecutionOpts {} /** * takerAssetData: String that represents a specific taker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). * makerAssetData: String that represents a specific maker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). - * makerAssetFillAmount: The amount of makerAsset to swap for. * orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested assetBuyAmount plus slippage. * feeOrders: An array of objects conforming to SignedOrder. These orders can be used to cover the fees for the orders param above. * bestCaseQuoteInfo: Info about the best case price for the asset. @@ -235,11 +226,19 @@ export interface SwapQuoteBase { worstCaseQuoteInfo: SwapQuoteInfo; } +/** + * takerAssetFillAmount: The amount of takerAsset sold for makerAsset. + * type: Specified MarketOperation the SwapQuote is provided for + */ export interface MarketSellSwapQuote extends SwapQuoteBase { takerAssetFillAmount: BigNumber; type: MarketOperation.Sell; } +/** + * makerAssetFillAmount: The amount of makerAsset bought with takerAsset. + * type: Specified MarketOperation the SwapQuote is provided for + */ export interface MarketBuySwapQuote extends SwapQuoteBase { makerAssetFillAmount: BigNumber; type: MarketOperation.Buy; @@ -254,6 +253,7 @@ export interface MarketSellSwapQuoteWithAffiliateFee extends SwapQuoteWithAffili export interface MarketBuySwapQuoteWithAffiliateFee extends SwapQuoteWithAffiliateFeeBase, MarketBuySwapQuote {} export type SwapQuoteWithAffiliateFee = MarketBuySwapQuoteWithAffiliateFee | MarketSellSwapQuoteWithAffiliateFee; + /** * assetEthAmount: The amount of eth required to pay for the requested asset. * feeEthAmount: The amount of eth required to pay any fee concerned with completing the swap. @@ -268,6 +268,7 @@ export interface SwapQuoteInfo { /** * shouldForceOrderRefresh: If set to true, new orders and state will be fetched instead of waiting for the next orderRefreshIntervalMs. Defaults to false. + * shouldDisableRequestingFeeOrders: If set to true, requesting a swapQuote will not perform any computation or requests for fees. * slippagePercentage: The percentage buffer to add to account for slippage. Affects max ETH price estimates. Defaults to 0.2 (20%). */ export interface SwapQuoteRequestOpts { diff --git a/packages/asset-swapper/src/utils/swap_quote_utils.ts b/packages/asset-swapper/src/utils/swap_quote_utils.ts deleted file mode 100644 index 6ea855aa10..0000000000 --- a/packages/asset-swapper/src/utils/swap_quote_utils.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { ContractWrappers, SupportedProvider, ZeroExProvider } from '@0x/contract-wrappers'; -import { providerUtils } from '@0x/utils'; -import * as _ from 'lodash'; - -import { constants } from '../constants'; -import { SwapQuote, SwapQuoteUtilsOpts } from '../types'; -import { assert } from '../utils/assert'; - -export class SwapQuoteUtils { - public readonly provider: ZeroExProvider; - public readonly networkId: number; - - private readonly _contractWrappers: ContractWrappers; - - constructor(supportedProvider: SupportedProvider, options: Partial = {}) { - const { networkId } = _.merge({}, constants.DEFAULT_SWAP_QUOTE_UTILS_OPTS, options); - assert.isNumber('networkId', networkId); - - const provider = providerUtils.standardizeOrThrow(supportedProvider); - this.provider = provider; - this.networkId = networkId; - this._contractWrappers = new ContractWrappers(this.provider, { - networkId, - }); - } - - public async isTakerAddressAllowanceEnoughForBestAndWorstQuoteInfoAsync( - swapQuote: SwapQuote, - takerAddress: string, - ): Promise<[boolean, boolean]> { - const orderValidatorWrapper = this._contractWrappers.orderValidator; - const balanceAndAllowance = await orderValidatorWrapper.getBalanceAndAllowanceAsync( - takerAddress, - swapQuote.takerAssetData, - ); - return [ - balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.bestCaseQuoteInfo.totalTakerTokenAmount), - balanceAndAllowance.allowance.isGreaterThanOrEqualTo(swapQuote.worstCaseQuoteInfo.totalTakerTokenAmount), - ]; - } -} From 8ce8bee76fa2efc59a4cab58d30cf3b97e13bed5 Mon Sep 17 00:00:00 2001 From: David Sun Date: Wed, 17 Jul 2019 15:22:48 -0700 Subject: [PATCH 18/18] prettier + lint --- packages/asset-swapper/src/constants.ts | 6 ------ packages/asset-swapper/src/index.ts | 1 - .../src/quote_consumers/exchange_swap_quote_consumer.ts | 1 - packages/asset-swapper/src/types.ts | 3 ++- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/asset-swapper/src/constants.ts b/packages/asset-swapper/src/constants.ts index 463e49666e..f7654046d4 100644 --- a/packages/asset-swapper/src/constants.ts +++ b/packages/asset-swapper/src/constants.ts @@ -8,7 +8,6 @@ import { OrdersAndFillableAmounts, SwapQuoteRequestOpts, SwapQuoterOpts, - SwapQuoteUtilsOpts, } from './types'; const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; @@ -22,10 +21,6 @@ const DEFAULT_SWAP_QUOTER_OPTS: SwapQuoterOpts = { expiryBufferMs: 120000, // 2 minutes }; -const DEFAULT_SWAP_QUOTE_UTILS_OPTS: SwapQuoteUtilsOpts = { - networkId: MAINNET_NETWORK_ID, -}; - const DEFAULT_FORWARDER_SWAP_QUOTE_GET_OPTS: ForwarderSwapQuoteGetOutputOpts = { feePercentage: 0, feeRecipient: NULL_ADDRESS, @@ -62,5 +57,4 @@ export const constants = { EMPTY_ORDERS_AND_FILLABLE_AMOUNTS, DEFAULT_PER_PAGE, DEFAULT_LIQUIDITY_REQUEST_OPTS, - DEFAULT_SWAP_QUOTE_UTILS_OPTS, }; diff --git a/packages/asset-swapper/src/index.ts b/packages/asset-swapper/src/index.ts index af5ab2c12a..3321fff960 100644 --- a/packages/asset-swapper/src/index.ts +++ b/packages/asset-swapper/src/index.ts @@ -33,7 +33,6 @@ export { StandardRelayerAPIOrderProvider } from './order_providers/standard_rela export { SwapQuoterError, SwapQuoterOpts, - SwapQuoteUtilsOpts, SwapQuote, SwapQuoteConsumerOpts, CalldataInfo, diff --git a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts index a88b383310..140d6ee856 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts @@ -1,5 +1,4 @@ import { ContractWrappers, ContractWrappersError, ForwarderWrapperError } from '@0x/contract-wrappers'; -import { calldataOptimizationUtils } from '@0x/contract-wrappers/lib/src/utils/calldata_optimization_utils'; import { MarketOperation } from '@0x/types'; import { AbiEncoder, providerUtils } from '@0x/utils'; import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; diff --git a/packages/asset-swapper/src/types.ts b/packages/asset-swapper/src/types.ts index 0d76d285c9..cf7502746d 100644 --- a/packages/asset-swapper/src/types.ts +++ b/packages/asset-swapper/src/types.ts @@ -98,7 +98,8 @@ export interface ExchangeMarketSellSmartContractParams extends SmartContractPara * Represents the varying smart contracts that can consume a valid swap quote */ export enum ConsumerType { - Forwarder, Exchange, + Forwarder, + Exchange, } /**