From 3653c8d656704a638a5934c73a80dbce871f6570 Mon Sep 17 00:00:00 2001 From: Van0k Date: Tue, 26 Dec 2023 12:22:09 +0400 Subject: [PATCH 1/2] feat: add degen nft minting to live/attach tests --- contracts/test/helpers/IntegrationTestHelper.sol | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contracts/test/helpers/IntegrationTestHelper.sol b/contracts/test/helpers/IntegrationTestHelper.sol index 0c8c4bda..779fc4ce 100644 --- a/contracts/test/helpers/IntegrationTestHelper.sol +++ b/contracts/test/helpers/IntegrationTestHelper.sol @@ -317,6 +317,8 @@ contract IntegrationTestHelper is TestHelper, BalanceHelper, ConfigManager { creditFacade = CreditFacadeV3(creditManager.creditFacade()); creditConfigurator = CreditConfiguratorV3(creditManager.creditConfigurator()); + address degenNFT = creditFacade.degenNFT(); + if (!_attachPool(creditManager.pool())) { return false; } @@ -325,7 +327,7 @@ contract IntegrationTestHelper is TestHelper, BalanceHelper, ConfigManager { return false; } - if (!anyDegenNFT && whitelisted != (creditFacade.degenNFT() != address(0))) { + if (!anyDegenNFT && whitelisted != (degenNFT != address(0))) { return false; } if (configAccountAmount == 0) { @@ -334,6 +336,13 @@ contract IntegrationTestHelper is TestHelper, BalanceHelper, ConfigManager { creditAccountAmount = configAccountAmount; } + if (degenNFT != address(0)) { + address minter = DegenNFTV2(degenNFT).minter(); + + vm.prank(minter); + DegenNFTV2(degenNFT).mint(USER, 1000); + } + return true; } @@ -386,6 +395,9 @@ contract IntegrationTestHelper is TestHelper, BalanceHelper, ConfigManager { vm.prank(CONFIGURATOR); degenNFT.setMinter(CONFIGURATOR); + vm.prank(CONFIGURATOR); + degenNFT.mint(USER, 1000); + uint256 len = allCms.length; for (uint256 i; i < len; ++i) { From 10ddfc1256d928bd82e880a49c332bcb86fe9a88 Mon Sep 17 00:00:00 2001 From: Van0k Date: Tue, 26 Dec 2023 14:10:27 +0400 Subject: [PATCH 2/2] fix: test fix --- .../test/integration/credit/OpenCreditAccount.int.t.sol | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contracts/test/integration/credit/OpenCreditAccount.int.t.sol b/contracts/test/integration/credit/OpenCreditAccount.int.t.sol index a7264c17..ef220e30 100644 --- a/contracts/test/integration/credit/OpenCreditAccount.int.t.sol +++ b/contracts/test/integration/credit/OpenCreditAccount.int.t.sol @@ -116,14 +116,16 @@ contract OpenCreditAccountIntegrationTest is IntegrationTestHelper, ICreditFacad function test_I_OCA_03_openCreditAccount_burns_token_in_whitelisted_mode() public withDegenNFT creditTest { IDegenNFTV2 degenNFT = IDegenNFTV2(creditFacade.degenNFT()); + uint256 startingBalance = degenNFT.balanceOf(USER); + vm.prank(CONFIGURATOR); degenNFT.mint(USER, 2); - expectBalance(address(degenNFT), USER, 2); + expectBalance(address(degenNFT), USER, startingBalance + 2); _openTestCreditAccount(); - expectBalance(address(degenNFT), USER, 1); + expectBalance(address(degenNFT), USER, startingBalance + 1); } // // /// @dev I:[OCA-4]: openCreditAccount sets correct values