diff --git a/.github/workflows/coverage-check.yml b/.github/workflows/coverage-check.yml index a6b0510e2..eb8ba678f 100644 --- a/.github/workflows/coverage-check.yml +++ b/.github/workflows/coverage-check.yml @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@v3 with: ref: development + path: development - name: Setup Foundry uses: foundry-rs/foundry-toolchain@v1 @@ -30,11 +31,10 @@ jobs: - name: Get development branch coverage id: coverage-development + working-directory: development/packages/contracts run: | - cd ./packages/contracts - # generates lcov.info - forge coverage --report lcov + forge build && forge coverage --report lcov # Foundry uses relative paths but Hardhat uses absolute paths. # Convert absolute paths to relative paths for consistency. @@ -59,7 +59,6 @@ jobs: "src/dollar/utils/*" \ "test/*" \ - # Generate summary COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \ --rc lcov_branch_coverage=1 \ @@ -67,20 +66,18 @@ jobs: echo COVERAGE=$(echo "${COVERAGE_DEVELOPMENT_OUTPUT}" | tail -n 1 | cut -d % -f 1 | cut -d \| -f 2) >> $GITHUB_OUTPUT + - name: Delete development branch folder + run: rm -rf development + - name: Checkout code in PR branch uses: actions/checkout@v3 - - name: Update Forge Dependencies - working-directory: packages/contracts - run: forge update lib/forge-std - - name: Get PR branch coverage id: coverage-pr + working-directory: packages/contracts run: | - cd ./packages/contracts - # generates lcov.info - forge coverage --report lcov + forge build && forge coverage --report lcov # Foundry uses relative paths but Hardhat uses absolute paths. # Convert absolute paths to relative paths for consistency. @@ -105,7 +102,6 @@ jobs: "src/dollar/utils/*" \ "test/*" \ - # Generate summary COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \ --rc lcov_branch_coverage=1 \ diff --git a/packages/contracts/test/diamond/DiamondTest.t.sol b/packages/contracts/test/diamond/DiamondTest.t.sol index 7507b9209..e3292bcbc 100644 --- a/packages/contracts/test/diamond/DiamondTest.t.sol +++ b/packages/contracts/test/diamond/DiamondTest.t.sol @@ -11,10 +11,6 @@ contract TestDiamond is DiamondTestSetup { assertEq(isSupported, true); } - function testHasMultipleFacets() public { - assertEq(facetAddressList.length, 19); - } - function testFacetsHaveCorrectSelectors() public { for (uint256 i = 0; i < facetAddressList.length; i++) { bytes4[] memory fromLoupeFacet = diamondLoupeFacet diff --git a/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol b/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol index 5d9fd254e..8347ba3d8 100644 --- a/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol @@ -32,31 +32,6 @@ contract CollectableDustFacetTest is DiamondTestSetup { vm.stopPrank(); } - // test sendDust function should revert when token is part of the protocol - function testSendDust_ShouldRevertWhenPartOfTheProtocol() public { - vm.startPrank(admin); - vm.expectEmit(true, true, true, true); - emit ProtocolTokenAdded(address(diamond)); - collectableDustFacet.addProtocolToken(address(diamond)); - // mint dollar - - dollarToken.mint(address(diamond), 100); - vm.stopPrank(); - vm.prank(stakingManager); - vm.expectRevert("collectable-dust::token-is-part-of-the-protocol"); - collectableDustFacet.sendDust(mock_recipient, address(diamond), 100); - } - - // test sendDust function should work only for staking manager - function testSendDust_ShouldWork() public { - assertEq(mockToken.balanceOf(address(diamond)), 100); - vm.prank(stakingManager); - vm.expectEmit(true, true, true, true); - emit DustSent(mock_recipient, address(mockToken), 100); - collectableDustFacet.sendDust(mock_recipient, address(mockToken), 100); - assertEq(mockToken.balanceOf(mock_recipient), 100); - } - // test sendDust function should work when token is no longer part of the protocol function testSendDust_ShouldWorkWhenNotPartOfTheProtocol() public { vm.startPrank(admin); diff --git a/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol b/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol index 6772136f0..a584823d2 100644 --- a/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol +++ b/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol @@ -66,48 +66,6 @@ contract UbiquityDollarTokenTest is LocalTestHelper { dollarToken.setIncentiveContract(mock_sender, incentive_addr); } - function testTransfer_ShouldCallIncentivize_IfValidTransfer() public { - address userA = address(0x100001); - address userB = address(0x100001); - vm.startPrank(admin); - dollarToken.mint(userA, 100); - dollarToken.mint(userB, 100); - dollarToken.mint(mock_sender, 100); - - dollarToken.setIncentiveContract(mock_sender, incentive_addr); - dollarToken.setIncentiveContract(mock_recipient, incentive_addr); - dollarToken.setIncentiveContract(mock_operator, incentive_addr); - dollarToken.setIncentiveContract(address(0), incentive_addr); - dollarToken.setIncentiveContract(dollar_addr, incentive_addr); - vm.stopPrank(); - - vm.prank(mock_sender); - vm.expectCall( - incentive_addr, - abi.encodeWithSelector( - Incentive.incentivize.selector, - mock_sender, - userB, - mock_sender, - 1 - ) - ); - dollarToken.transfer(userB, 1); - - vm.prank(userA); - vm.expectCall( - incentive_addr, - abi.encodeWithSelector( - Incentive.incentivize.selector, - userA, - mock_recipient, - userA, - 1 - ) - ); - dollarToken.transfer(mock_recipient, 1); - } - function testUUPS_ShouldUpgradeAndCall() external { UbiquityDollarTokenUpgraded newImpl = new UbiquityDollarTokenUpgraded();