@@ -1066,8 +1066,8 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
10661066 morphoVaultPositions: emptyMorphoVaultPositions_ ()
10671067 });
10681068
1069- // Transfer 1.5ETH to 0xceecee on chain 1
1070- // Should able to have auto unwrapping 0 .5 WETH to ETH to cover the amount
1069+ // Transfer 1.5 ETH to 0xceecee on chain 1
1070+ // Should unwrap up to 1 .5 WETH to ETH to cover the amount (0.5 WETH will actually be unwrapped)
10711071 QuarkBuilder.BuilderResult memory result = builder.transfer (
10721072 transferEth_ (1 , 1.5e18 , address (0xceecee ), BLOCK_TIMESTAMP), chainAccountsList, paymentUsd_ ()
10731073 );
@@ -1089,13 +1089,14 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
10891089 callContracts[0 ] = wrapperActionsAddress;
10901090 callContracts[1 ] = transferActionsAddress;
10911091 bytes [] memory callDatas = new bytes [](2 );
1092- callDatas[0 ] =
1093- abi.encodeWithSelector (WrapperActions.unwrapAllWETH.selector , 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 );
1092+ callDatas[0 ] = abi.encodeWithSelector (
1093+ WrapperActions.unwrapWETHUpTo.selector , 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 , 1.5e18
1094+ );
10941095 callDatas[1 ] = abi.encodeWithSelector (TransferActions.transferNativeToken.selector , address (0xceecee ), 1.5e18 );
10951096 assertEq (
10961097 result.quarkOperations[0 ].scriptCalldata,
10971098 abi.encodeWithSelector (Multicall.run.selector , callContracts, callDatas),
1098- "calldata is Multicall.run([wrapperActionsAddress, transferActionsAddress], [WrapperActions.unwrapAllWETH (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2), TransferActions.transferNativeToken(address(0xceecee), 1.5e18)]); "
1099+ "calldata is Multicall.run([wrapperActionsAddress, transferActionsAddress], [WrapperActions.unwrapWETHUpTo (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 1.5e18 ), TransferActions.transferNativeToken(address(0xceecee), 1.5e18)]); "
10991100 );
11001101 assertEq (
11011102 result.quarkOperations[0 ].expiry, BLOCK_TIMESTAMP + 7 days, "expiry is current blockTimestamp + 7 days "
@@ -1172,8 +1173,8 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
11721173 morphoVaultPositions: emptyMorphoVaultPositions_ ()
11731174 });
11741175
1175- // Transfer 1.5ETH to 0xceecee on chain 1
1176- // Should able to have auto unwrapping 0 .5 WETH to ETH to cover the amount
1176+ // Transfer 1.5 ETH to 0xceecee on chain 1
1177+ // Should unwrap up to 1 .5 WETH to ETH to cover the amount (0.5 WETH will actually be unwrapped)
11771178 QuarkBuilder.BuilderResult memory result = builder.transfer (
11781179 transferEth_ (1 , 1.5e18 , address (0xceecee ), BLOCK_TIMESTAMP), chainAccountsList, paymentUsdc_ (maxCosts)
11791180 );
@@ -1198,8 +1199,9 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
11981199 callContracts[0 ] = wrapperActionsAddress;
11991200 callContracts[1 ] = transferActionsAddress;
12001201 bytes [] memory callDatas = new bytes [](2 );
1201- callDatas[0 ] =
1202- abi.encodeWithSelector (WrapperActions.unwrapAllWETH.selector , 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 );
1202+ callDatas[0 ] = abi.encodeWithSelector (
1203+ WrapperActions.unwrapWETHUpTo.selector , 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 , 1.5e18
1204+ );
12031205 callDatas[1 ] = abi.encodeWithSelector (TransferActions.transferNativeToken.selector , address (0xceecee ), 1.5e18 );
12041206 assertEq (
12051207 result.quarkOperations[0 ].scriptCalldata,
@@ -1209,7 +1211,7 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
12091211 abi.encodeWithSelector (Multicall.run.selector , callContracts, callDatas),
12101212 1e5
12111213 ),
1212- "calldata is Paycall.run(Multicall.run([wrapperActionsAddress, transferActionsAddress], [WrapperActions.unwrapAllWETH (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2), TransferActions.transferNativeToken(address(0xceecee), 1.5e18)]), 1e5); "
1214+ "calldata is Paycall.run(Multicall.run([wrapperActionsAddress, transferActionsAddress], [WrapperActions.unwrapWETHUpTo (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 1.5e18 ), TransferActions.transferNativeToken(address(0xceecee), 1.5e18)]), 1e5); "
12131215 );
12141216 assertEq (
12151217 result.quarkOperations[0 ].expiry, BLOCK_TIMESTAMP + 7 days, "expiry is current blockTimestamp + 7 days "
@@ -1286,8 +1288,8 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
12861288 morphoVaultPositions: emptyMorphoVaultPositions_ ()
12871289 });
12881290
1289- // Transfer max ETH to 0xceecee on chain 1
1290- // Should able to have auto unwrapping 0.5 WETH to ETH to cover the amount
1291+ // Transfer max (2) ETH to 0xceecee on chain 1
1292+ // Should unwrap up to 2 WETH to ETH to cover the amount (1 WETH will actually be unwrapped)
12911293 QuarkBuilder.BuilderResult memory result = builder.transfer (
12921294 transferEth_ (1 , type (uint256 ).max, address (0xceecee ), BLOCK_TIMESTAMP),
12931295 chainAccountsList,
@@ -1314,8 +1316,9 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
13141316 callContracts[0 ] = wrapperActionsAddress;
13151317 callContracts[1 ] = transferActionsAddress;
13161318 bytes [] memory callDatas = new bytes [](2 );
1317- callDatas[0 ] =
1318- abi.encodeWithSelector (WrapperActions.unwrapAllWETH.selector , 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 );
1319+ callDatas[0 ] = abi.encodeWithSelector (
1320+ WrapperActions.unwrapWETHUpTo.selector , 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 , 2e18
1321+ );
13191322 callDatas[1 ] = abi.encodeWithSelector (TransferActions.transferNativeToken.selector , address (0xceecee ), 2e18 );
13201323 assertEq (
13211324 result.quarkOperations[0 ].scriptCalldata,
@@ -1325,7 +1328,7 @@ contract QuarkBuilderTransferTest is Test, QuarkBuilderTest {
13251328 abi.encodeWithSelector (Multicall.run.selector , callContracts, callDatas),
13261329 1e5
13271330 ),
1328- "calldata is Quotecall.run(Multicall.run([wrapperActionsAddress, transferActionsAddress], [WrapperActions.unwrapAllWETH (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2), TransferActions.transferNativeToken(address(0xceecee), 2e18)]), 1e5); "
1331+ "calldata is Quotecall.run(Multicall.run([wrapperActionsAddress, transferActionsAddress], [WrapperActions.unwrapWETHUpTo (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 2e18 ), TransferActions.transferNativeToken(address(0xceecee), 2e18)]), 1e5); "
13291332 );
13301333 assertEq (
13311334 result.quarkOperations[0 ].expiry, BLOCK_TIMESTAMP + 7 days, "expiry is current blockTimestamp + 7 days "
0 commit comments