* MetaTransactionData changes * MetaTransactionV2 creation and forge tests * MetaTransactionData changes * MetaTransactionV2 creation and forge tests * add multiplexBatchSellTokenForToken, multiplexMultiHopSellTokenForToken, multiplex TokenForEth functions to metatransactions, add msgSender field to multiplex params * Ran prettier to clean up * More linting * Fixing issues with EIP 712 signature, adding test case against MetaMask, and fixing lint issues * Addressing suggestions from PR reviewers * Complex rebase of test code based on changes in #655 * Fixing multiplex test failure * add some tests for multiplex metatransactions * prettier * minor test fix * cleaning up and adding batchExecuteMetaTransaction tests * Removing ZERO_ADDRESS * add multiHopBatchSellOtc to MultiplexFeature, fix _computeHopTarget for MultiplexSubcall.OTC [#667] * fix _computeHopTarget for otc subcalls * Fixing multiHopSellOtcOrder when params.useSelfBalance is true * Making executeMetaTransactionV2 nonpayable and addressing a few other minor issues * Forge update * Add MetaTransactionsFeatureV2 to exported contracts --------- Co-authored-by: abls <112491550+abls@users.noreply.github.com> Co-authored-by: Duncan Townsend <git@duncancmt.com>
44 lines
1.5 KiB
Solidity
44 lines
1.5 KiB
Solidity
// SPDX-License-Identifier: Apache-2.0
|
|
/*
|
|
Copyright 2023 ZeroEx Intl.
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
pragma solidity ^0.6;
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
import "forge-std/Test.sol";
|
|
|
|
import "src/transformers/LibERC20Transformer.sol";
|
|
|
|
contract TestUtils is Test {
|
|
address private constant ZERO_ADDRESS = 0x0000000000000000000000000000000000000000;
|
|
|
|
function _findTransformerNonce(address transformer, address deployer) internal pure returns (uint32) {
|
|
address current;
|
|
for (uint32 i = 0; i < 1024; i++) {
|
|
current = LibERC20Transformer.getDeployedAddress(deployer, i);
|
|
if (current == transformer) {
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
|
|
// gets a dummy signer
|
|
function _getSigner() internal returns (address, uint) {
|
|
string memory mnemonic = "test test test test test test test test test test test junk";
|
|
uint256 privateKey = vm.deriveKey(mnemonic, 0);
|
|
|
|
vm.label(vm.addr(privateKey), "zeroEx/MarketMaker");
|
|
return (vm.addr(privateKey), privateKey);
|
|
}
|
|
}
|