From 486a55a9b6a93246d13192a705269258c9c8ca42 Mon Sep 17 00:00:00 2001 From: dan13ram Date: Wed, 4 Sep 2024 19:53:53 +0530 Subject: [PATCH] testing --- test/CrossChainBaseTest.t.sol | 26 ++++++-------------------- test/L1YnOFTAdapterUpgradeable.t.sol | 13 ++++++++++--- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/test/CrossChainBaseTest.t.sol b/test/CrossChainBaseTest.t.sol index f844dd9..de91c0e 100644 --- a/test/CrossChainBaseTest.t.sol +++ b/test/CrossChainBaseTest.t.sol @@ -20,8 +20,6 @@ contract CrossChainBaseTest is TestHelper { ImmutableMultiChainDeployer public mainnetDeployer; ImmutableMultiChainDeployer public optimismDeployer; ImmutableMultiChainDeployer public arbitrumDeployer; - // ImmutableMultiChainDeployer public baseDeployer; - // ImmutableMultiChainDeployer public fraxDeployer; L1YnOFTAdapterUpgradeable public mainnetOFTAdapter; L2YnOFTAdapterUpgradeable public optimismOFTAdapter; @@ -36,9 +34,6 @@ contract CrossChainBaseTest is TestHelper { EndpointV2 public mainnetLzEndpoint = EndpointV2(0x1a44076050125825900e736c501f859c50fE728c); ERC20Mock public mainnetERC20; - // LZEndpointMock public mainnetLZEndpoint; - // LZEndpointMock public optimismLZEndpoint; - // LZEndpointMock public arbitrumLzEndpoint; L2YnERC20Upgradeable public optimismERC20; L2YnERC20Upgradeable public arbitrumERC20; @@ -52,22 +47,12 @@ contract CrossChainBaseTest is TestHelper { uint32 optimismEid; uint32 arbitrumEid; - // uint256 holeskyFork; - // uint256 fraxFork; - // uint256 baseFork; - function setUp() public virtual override { // create forks optimismFork = vm.createFork(vm.envString("OPTIMISM_RPC_URL"), 124909408); arbitrumFork = vm.createFork(vm.envString("ARBITRUM_RPC_URL"), 249855816); mainnetFork = vm.createFork(vm.envString("MAINNET_RPC_URL"), 20674289); - // holeskyFork = vm.createFork(vm.envString("HOLESKY_RPC_URL"), 2266061); - // fraxFork = vm.createFork(vm.envString("FRAX_RPC_URL"), 9303466); - // baseFork = vm.createFork(vm.envString("BASE_RPC_URL"), 19314154); - // mainnetLZEndpoint = new LZEndpointMock(1); - // optimismLZEndpoint = new LZEndpointMock(10); - // arbitrumLzEndpoint = new LZEndpointMock(42161); vm.selectFork(mainnetFork); mainnetEid = mainnetLzEndpoint.eid(); @@ -152,17 +137,18 @@ contract CrossChainBaseTest is TestHelper { ) ); } + vm.stopPrank(); endpoints[mainnetEid] = address(mainnetLzEndpoint); endpoints[optimismEid] = address(optimismLzEndpoint); endpoints[arbitrumEid] = address(arbitrumLzEndpoint); - // vm.selectFork(baseFork); - // baseDeployer = new ImmutableMultiChainDeployer(); - - // vm.selectFork(fraxFork); - // fraxDeployer = new ImmutableMultiChainDeployer(); + vm.startPrank(_owner); + vm.selectFork(optimismFork); + optimismERC20.grantRole(optimismERC20.MINTER_ROLE(), address(optimismOFTAdapter)); + vm.selectFork(arbitrumFork); + arbitrumERC20.grantRole(arbitrumERC20.MINTER_ROLE(), address(arbitrumOFTAdapter)); vm.stopPrank(); } diff --git a/test/L1YnOFTAdapterUpgradeable.t.sol b/test/L1YnOFTAdapterUpgradeable.t.sol index a8ce02f..16fd916 100644 --- a/test/L1YnOFTAdapterUpgradeable.t.sol +++ b/test/L1YnOFTAdapterUpgradeable.t.sol @@ -120,9 +120,16 @@ contract Test_L1YnOFTAdapterUpgradeable is CrossChainBaseTest { mainnetOFTAdapter.send{value: fee.nativeFee}(sendParam, fee, payable(address(_owner))); vm.stopPrank(); - // verifyPackets(bEid, addressToBytes32(address(bOFT))); + // The following fails + // vm.selectFork(arbitrumFork); + // vm.startPrank(_owner); + // verifyPackets(arbitrumEid, addressToBytes32(address(arbitrumOFTAdapter))); + // vm.stopPrank(); // - // assertEq(aOFT.balanceOf(userA), initialBalance - tokensToSend); - // assertEq(bOFT.balanceOf(userB), initialBalance + tokensToSend); + // vm.selectFork(mainnetFork); + // assertEq(mainnetERC20.balanceOf(userA), initialBalance - tokensToSend); + // + // vm.selectFork(arbitrumFork); + // assertEq(arbitrumERC20.balanceOf(userB), initialBalance + tokensToSend); } }