prettier and lint
This commit is contained in:
parent
4aaba03847
commit
29b7095a00
@ -31,7 +31,7 @@ import "./libs/LibNativeOrder.sol";
|
|||||||
import "./libs/LibSignature.sol";
|
import "./libs/LibSignature.sol";
|
||||||
|
|
||||||
/// @dev Feature for interacting with OTC orders.
|
/// @dev Feature for interacting with OTC orders.
|
||||||
contract OtcOrdersFeature is IFeature, IOtcOrdersFeature, FixinCommon, FixinEIP712, FixinTokenSpender{
|
contract OtcOrdersFeature is IFeature, IOtcOrdersFeature, FixinCommon, FixinEIP712, FixinTokenSpender {
|
||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
using LibSafeMathV06 for uint128;
|
using LibSafeMathV06 for uint128;
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ contract MultiplexFeature is
|
|||||||
// Compute the expected address and transfer the input tokens
|
// Compute the expected address and transfer the input tokens
|
||||||
// there if necessary.
|
// there if necessary.
|
||||||
state.from = _computeHopTarget(params, 0);
|
state.from = _computeHopTarget(params, 0);
|
||||||
|
|
||||||
// If the input tokens are currently held by `msg.sender` but
|
// If the input tokens are currently held by `msg.sender` but
|
||||||
// the first hop expects them elsewhere, perform a `transferFrom`.
|
// the first hop expects them elsewhere, perform a `transferFrom`.
|
||||||
if (!params.useSelfBalance && state.from != msg.sender) {
|
if (!params.useSelfBalance && state.from != msg.sender) {
|
||||||
@ -489,7 +489,7 @@ contract MultiplexFeature is
|
|||||||
// If `i == 0`, the target is the address which should hold the input
|
// If `i == 0`, the target is the address which should hold the input
|
||||||
// tokens prior to executing `calls[0]`. Otherwise, it is the address
|
// tokens prior to executing `calls[0]`. Otherwise, it is the address
|
||||||
// that should receive `tokens[i]` upon executing `calls[i-1]`.
|
// that should receive `tokens[i]` upon executing `calls[i-1]`.
|
||||||
function _computeHopTarget(MultiHopSellParams memory params, uint256 i) private returns (address target) {
|
function _computeHopTarget(MultiHopSellParams memory params, uint256 i) private returns (address target) {
|
||||||
if (i == params.calls.length) {
|
if (i == params.calls.length) {
|
||||||
// The last call should send the output tokens to the
|
// The last call should send the output tokens to the
|
||||||
// multi-hop sell recipient.
|
// multi-hop sell recipient.
|
||||||
@ -534,12 +534,11 @@ contract MultiplexFeature is
|
|||||||
} else {
|
} else {
|
||||||
target = address(this);
|
target = address(this);
|
||||||
}
|
}
|
||||||
} else if(subcall.id == MultiplexSubcall.OTC) {
|
} else if (subcall.id == MultiplexSubcall.OTC) {
|
||||||
//on the first call we want to pull tokens from the taker, subsequent calls should use the EP balance
|
//on the first call we want to pull tokens from the taker, subsequent calls should use the EP balance
|
||||||
if( i == 0) {
|
if (i == 0) {
|
||||||
target = msg.sender;
|
target = msg.sender;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
target = address(this);
|
target = address(this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,7 @@ import "../interfaces/IMultiplexFeature.sol";
|
|||||||
import "../interfaces/IOtcOrdersFeature.sol";
|
import "../interfaces/IOtcOrdersFeature.sol";
|
||||||
import "../libs/LibNativeOrder.sol";
|
import "../libs/LibNativeOrder.sol";
|
||||||
|
|
||||||
abstract contract MultiplexOtc is FixinEIP712{
|
abstract contract MultiplexOtc is FixinEIP712 {
|
||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
|
|
||||||
event ExpiredOtcOrder(bytes32 orderHash, address maker, uint64 expiry);
|
event ExpiredOtcOrder(bytes32 orderHash, address maker, uint64 expiry);
|
||||||
|
@ -29,9 +29,9 @@ import "src/transformers/bridges/BridgeProtocols.sol";
|
|||||||
import "src/features/OtcOrdersFeature.sol";
|
import "src/features/OtcOrdersFeature.sol";
|
||||||
|
|
||||||
contract MultiplexRfqtTest is Test, ForkUtils, TestUtils {
|
contract MultiplexRfqtTest is Test, ForkUtils, TestUtils {
|
||||||
|
|
||||||
using LibERC20TokenV06 for IERC20Token;
|
using LibERC20TokenV06 for IERC20Token;
|
||||||
using LibERC20TokenV06 for IEtherToken;
|
using LibERC20TokenV06 for IEtherToken;
|
||||||
|
|
||||||
function setUp() public {
|
function setUp() public {
|
||||||
_setup();
|
_setup();
|
||||||
}
|
}
|
||||||
@ -67,12 +67,15 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils {
|
|||||||
bytes32(0) // sushiswapPairInitCodeHash
|
bytes32(0) // sushiswapPairInitCodeHash
|
||||||
);
|
);
|
||||||
|
|
||||||
OtcOrdersFeature otcOrdersFeature = new OtcOrdersFeature(address(addresses.exchangeProxy), tokens.WrappedNativeToken);
|
OtcOrdersFeature otcOrdersFeature = new OtcOrdersFeature(
|
||||||
|
address(addresses.exchangeProxy),
|
||||||
|
tokens.WrappedNativeToken
|
||||||
|
);
|
||||||
|
|
||||||
vm.label(address(multiplexFeature), "zeroEx/NewMultiplexFeature");
|
vm.label(address(multiplexFeature), "zeroEx/NewMultiplexFeature");
|
||||||
vm.label(address(otcOrdersFeature), "zeroEx/NewOtcOrdersFeature");
|
vm.label(address(otcOrdersFeature), "zeroEx/NewOtcOrdersFeature");
|
||||||
vm.prank(IZeroEx(addresses.exchangeProxy).owner());
|
vm.prank(IZeroEx(addresses.exchangeProxy).owner());
|
||||||
|
|
||||||
IZeroEx(addresses.exchangeProxy).migrate(
|
IZeroEx(addresses.exchangeProxy).migrate(
|
||||||
address(otcOrdersFeature),
|
address(otcOrdersFeature),
|
||||||
abi.encodeWithSelector(OtcOrdersFeature.migrate.selector),
|
abi.encodeWithSelector(OtcOrdersFeature.migrate.selector),
|
||||||
@ -95,7 +98,6 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils {
|
|||||||
ContractAddresses memory addresses,
|
ContractAddresses memory addresses,
|
||||||
LiquiditySources memory sources
|
LiquiditySources memory sources
|
||||||
) public onlyForked {
|
) public onlyForked {
|
||||||
|
|
||||||
IZERO_EX = IZeroEx(addresses.exchangeProxy);
|
IZERO_EX = IZeroEx(addresses.exchangeProxy);
|
||||||
|
|
||||||
address[] memory tradeTokens = new address[](3);
|
address[] memory tradeTokens = new address[](3);
|
||||||
@ -139,8 +141,8 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils {
|
|||||||
subcalls[1] = subcall2;
|
subcalls[1] = subcall2;
|
||||||
|
|
||||||
uint balanceBefore = tokens.DAI.balanceOf(address(this));
|
uint balanceBefore = tokens.DAI.balanceOf(address(this));
|
||||||
emit log_named_uint("DAI Balance Before",balanceBefore);
|
emit log_named_uint("DAI Balance Before", balanceBefore);
|
||||||
emit log_string("Multihop Rfqt: WETH->USDC->DAI");
|
emit log_string("Multihop Rfqt: WETH->USDC->DAI");
|
||||||
|
|
||||||
/// @dev Sells `sellAmount` of the input token (`tokens[0]`)
|
/// @dev Sells `sellAmount` of the input token (`tokens[0]`)
|
||||||
/// via the given sequence of tokens and calls.
|
/// via the given sequence of tokens and calls.
|
||||||
@ -193,8 +195,6 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils {
|
|||||||
vm.startPrank(order.maker);
|
vm.startPrank(order.maker);
|
||||||
IERC20Token(order.makerToken).approveIfBelow(addresses.exchangeProxy, 2e20);
|
IERC20Token(order.makerToken).approveIfBelow(addresses.exchangeProxy, 2e20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
order.taker = address(0);
|
order.taker = address(0);
|
||||||
order.txOrigin = address(tx.origin);
|
order.txOrigin = address(tx.origin);
|
||||||
order.expiryAndNonce = encodeExpiryAndNonce(order.maker, bump);
|
order.expiryAndNonce = encodeExpiryAndNonce(order.maker, bump);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user