diff --git a/Makefile b/Makefile index 38a81ceb5..62a759cf9 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ build-sizes: ## Builds the project and shows sizes .PHONY: test-vvv test-vvv: ## Runs tests with verbose output - forge test --match-contract SXSVDNormal4626MultiTokenInputFromBeraNoSlippageAMB23 --evm-version cancun -vvv + forge test --match-contract MDMVDMulti0000NoTokenInputSlippageAMB12Permit2 --evm-version cancun -vvv .PHONY: ftest ftest: ## Runs tests with cancun evm version diff --git a/test/fuzz/scenarios/scenarios-deposit-multiDstMultiVaultDeposit/Multi.00.00.TokenInput.Slippage.AMB12.Permit2.sol b/test/fuzz/scenarios/scenarios-deposit-multiDstMultiVaultDeposit/Multi.00.00.TokenInput.Slippage.AMB12.Permit2.sol new file mode 100644 index 000000000..1d6a48542 --- /dev/null +++ b/test/fuzz/scenarios/scenarios-deposit-multiDstMultiVaultDeposit/Multi.00.00.TokenInput.Slippage.AMB12.Permit2.sol @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.23; + +// Test Utils +import "../../../utils/ProtocolActions.sol"; + +contract MDMVDMulti0000NoTokenInputSlippageAMB12Permit2 is ProtocolActions { + function setUp() public override { + chainIds = [ETH, OP]; + + super.setUp(); + /*////////////////////////////////////////////////////////////// + !! WARNING !! DEFINE TEST SETTINGS HERE + //////////////////////////////////////////////////////////////*/ + + AMBs = [1, 2]; + MultiDstAMBs = [AMBs, AMBs]; + + CHAIN_0 = OP; + DST_CHAINS = [OP, ETH]; + + /// @dev define vaults amounts and slippage for every destination chain and for every action + TARGET_UNDERLYINGS[OP][0] = [0, 1]; + TARGET_UNDERLYINGS[ETH][0] = [1, 0]; + + TARGET_VAULTS[OP][0] = [0, 0]; + TARGET_VAULTS[ETH][0] = [0, 0]; + + TARGET_FORM_KINDS[OP][0] = [0, 0]; + TARGET_FORM_KINDS[ETH][0] = [0, 0]; + + MAX_SLIPPAGE = 1000; + + LIQ_BRIDGES[OP][0] = [1, 1]; + LIQ_BRIDGES[ETH][0] = [1, 1]; + + RECEIVE_4626[OP][0] = [false, false]; + RECEIVE_4626[ETH][0] = [false, false]; + + actions.push( + TestAction({ + action: Actions.DepositPermit2, + multiVaults: true, //!!WARNING turn on or off multi vaults + user: 0, + testType: TestType.Pass, + revertError: "", + revertRole: "", + slippage: 421, // 0% <- if we are testing a pass this must be below each maxSlippage, + dstSwap: false, + externalToken: 1 // 0 = DAI, 1 = USDT, 2 = WETH + }) + ); + } + + /*/////////////////////////////////////////////////////////////// + SCENARIO TESTS + //////////////////////////////////////////////////////////////*/ + + function test_scenario(uint128 amountOne_, uint128 amountTwo_) public { + /// @dev amount = 1 after slippage will become 0, hence starting with 2 + amountOne_ = uint128(bound(amountOne_, 2 * 10 ** 6, TOTAL_SUPPLY_USDC / 4)); + amountTwo_ = uint128(bound(amountTwo_, 2 * 10 ** 6, TOTAL_SUPPLY_USDC / 4)); + AMOUNTS[OP][0] = [amountOne_, amountTwo_]; + AMOUNTS[ETH][0] = [amountTwo_, amountOne_]; + + for (uint256 act; act < actions.length; ++act) { + TestAction memory action = actions[act]; + MultiVaultSFData[] memory multiSuperformsData; + SingleVaultSFData[] memory singleSuperformsData; + MessagingAssertVars[] memory aV; + StagesLocalVars memory vars; + bool success; + + _runMainStages(action, act, multiSuperformsData, singleSuperformsData, aV, vars, success); + } + } +} diff --git a/test/utils/CommonProtocolActions.sol b/test/utils/CommonProtocolActions.sol index 1b6b40a8a..d5487e0c9 100644 --- a/test/utils/CommonProtocolActions.sol +++ b/test/utils/CommonProtocolActions.sol @@ -144,7 +144,6 @@ abstract contract CommonProtocolActions is BaseSetup { abi.encodeWithSelector(LiFiMock.swapAndStartBridgeTokensViaBridge.selector, bridgeData, swapData); } else { LibSwap.SwapData[] memory swapData = new LibSwap.SwapData[](1); - swapData[0] = LibSwap.SwapData( address(0), /// @dev callTo (arbitrary) @@ -181,7 +180,7 @@ abstract contract CommonProtocolActions is BaseSetup { } else if (args.liqBridgeKind == 2) { /// @notice bridge id 2 doesn't support same chain swaps if (args.toChainId == args.srcChainId) { - revert(); + revert("bridge id 2 doesn't support same chain swaps: "); } ISocketRegistry.BridgeRequest memory bridgeRequest; diff --git a/test/utils/ProtocolActions.sol b/test/utils/ProtocolActions.sol index 6906f2de2..daed4223d 100644 --- a/test/utils/ProtocolActions.sol +++ b/test/utils/ProtocolActions.sol @@ -3316,7 +3316,7 @@ abstract contract ProtocolActions is CommonProtocolActions { /// @notice ID: 2 Hyperlane if (AMBs[i] == 2) { HyperlaneHelper(getContract(TO_CHAIN, "HyperlaneHelper")).help( - address(HYPERLANE_MAILBOXES[TO_CHAIN]), // BARTIO + address(HYPERLANE_MAILBOXES[TO_CHAIN]), // BARTIO address(HYPERLANE_MAILBOXES[FROM_CHAIN]), // SEPOLIA FORKS[FROM_CHAIN], // SEPOLIA logs