Skip to content

Commit

Permalink
test: move al the mock contracts to root directory
Browse files Browse the repository at this point in the history
- Remove the empty mocks
- Remove repeated mocks
  • Loading branch information
adjisb authored and Maxime Vanmeerbeck committed Sep 29, 2023
1 parent 3d86770 commit e17fdfe
Show file tree
Hide file tree
Showing 47 changed files with 74 additions and 324 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions packages/marketplace/contracts/exchange/mocks/TestERC20.sol

This file was deleted.

6 changes: 0 additions & 6 deletions packages/marketplace/contracts/exchange/mocks/TestERC721.sol

This file was deleted.

This file was deleted.

This file was deleted.

108 changes: 0 additions & 108 deletions packages/marketplace/contracts/exchange/mocks/tokens/ERC2981.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.21;

import {LibPart} from "../../lib-part/LibPart.sol";
import {LibPart} from "../lib-part/LibPart.sol";

abstract contract AbstractRoyalties {
mapping(uint256 => LibPart.Part[]) internal royalties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
pragma solidity 0.8.21;

import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import {IERC1155LazyMint} from "../erc-1155/IERC1155LazyMint.sol";
import {LibERC1155LazyMint} from "../erc-1155/LibERC1155LazyMint.sol";
import {IERC1155LazyMint, LibERC1155LazyMint} from "../lazy-mint/erc-1155/IERC1155LazyMint.sol";

contract ERC1155LazyMintTest is IERC1155LazyMint, ERC1155Upgradeable {
function mintAndTransfer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity 0.8.21;

import {LibERC1155LazyMint} from "../erc-1155/LibERC1155LazyMint.sol";
import {ECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
import {LibERC1155LazyMint} from "../lazy-mint/erc-1155/LibERC1155LazyMint.sol";

contract ERC1155Test is EIP712Upgradeable {
using ECDSAUpgradeable for bytes32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity 0.8.21;

import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {IERC721LazyMint, LibERC721LazyMint} from "../erc-721/IERC721LazyMint.sol";
import {IERC721LazyMint, LibERC721LazyMint} from "../lazy-mint/erc-721/IERC721LazyMint.sol";

contract ERC721LazyMintTest is IERC721LazyMint, ERC721Upgradeable {
function mintAndTransfer(LibERC721LazyMint.Mint721Data memory data, address to) external override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity 0.8.21;

import {LibERC721LazyMint} from "../erc-721/LibERC721LazyMint.sol";
import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
import {ECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import {LibERC721LazyMint} from "../lazy-mint/erc-721/LibERC721LazyMint.sol";

contract ERC721Test is EIP712Upgradeable {
using ECDSAUpgradeable for bytes32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.21;

import {LibFeeSide} from "../lib/LibFeeSide.sol";
import {LibFeeSide} from "../transfer-manager/lib/LibFeeSide.sol";

contract LibFeeSideTest {
function getFeeSideTest(bytes4 maker, bytes4 taker) external pure returns (LibFeeSide.FeeSide) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity 0.8.21;

import {LibOrder} from "../../lib-order/LibOrder.sol";
import {LibFill} from "../libraries/LibFill.sol";
import {LibOrder} from "../lib-order/LibOrder.sol";
import {LibFill} from "../exchange/libraries/LibFill.sol";

contract LibFillTest {
function fillOrder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.21;

import {LibOrder, LibAsset} from "../../lib-order/LibOrder.sol";
import {LibOrder, LibAsset} from "../lib-order/LibOrder.sol";

contract LibOrderTest {
function calculateRemaining(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.21;

import {IERC2981} from "../IERC2981.sol";
import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";

contract Royalties2981Test {
IERC2981 internal immutable ROYALTIES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity 0.8.21;

import {IERC2981} from "../IERC2981.sol";
import {LibRoyalties2981} from "../LibRoyalties2981.sol";
import {LibPart} from "../../lib-part/LibPart.sol";
import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";
import {LibRoyalties2981} from "../royalties/LibRoyalties2981.sol";
import {LibPart} from "../lib-part/LibPart.sol";

contract Royalties2981TestImpl is IERC2981 {
uint256 public royaltiesBasePoint;
Expand All @@ -24,4 +24,8 @@ contract Royalties2981TestImpl is IERC2981 {
function calculateRoyaltiesTest(address payable to, uint96 amount) external pure returns (LibPart.Part[] memory) {
return LibRoyalties2981.calculateRoyalties(to, amount);
}

function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC2981).interfaceId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity 0.8.21;

import {IRoyaltiesProvider} from "../../../interfaces/IRoyaltiesProvider.sol";
import {LibPart} from "../../../lib-part/LibPart.sol";
import {IRoyaltiesProvider} from "../interfaces/IRoyaltiesProvider.sol";
import {LibPart} from "../lib-part/LibPart.sol";

contract RoyaltiesProviderTest is IRoyaltiesProvider {
mapping(address => mapping(uint256 => LibPart.Part[])) internal royaltiesTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity 0.8.21;

import {IRoyaltiesProvider} from "../../../interfaces/IRoyaltiesProvider.sol";
import {LibPart} from "../../../lib-part/LibPart.sol";
import {IRoyaltiesProvider} from "../interfaces/IRoyaltiesProvider.sol";
import {LibPart} from "../lib-part/LibPart.sol";

contract RoyaltiesRegistryTest {
event GetRoyaltiesTest(LibPart.Part[] royalties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

pragma solidity 0.8.21;

import {TransferManager} from "../TransferManager.sol";
import {LibERC721LazyMint} from "../../lazy-mint/erc-721/LibERC721LazyMint.sol";
import {LibERC1155LazyMint, LibPart} from "../../lazy-mint/erc-1155/LibERC1155LazyMint.sol";
import {TransferExecutor, LibAsset} from "../TransferExecutor.sol";
import {LibERC721LazyMint} from "../lazy-mint/erc-721/LibERC721LazyMint.sol";
import {LibERC1155LazyMint, LibPart} from "../lazy-mint/erc-1155/LibERC1155LazyMint.sol";
import {TransferManager} from "../transfer-manager/TransferManager.sol";
import {TransferExecutor, LibAsset} from "../transfer-manager/TransferExecutor.sol";

contract SimpleTest is TransferManager, TransferExecutor {
function getRoyaltiesByAssetTest(LibAsset.AssetType memory matchNft) external returns (LibPart.Part[] memory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.21;

import {ITransferManager, LibDeal} from "../../transfer-manager/interfaces/ITransferManager.sol";
import {ITransferManager, LibDeal} from "../transfer-manager/interfaces/ITransferManager.sol";

abstract contract SimpleTransferManager is ITransferManager {
function doTransfers(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity 0.8.21;

import {IAssetMatcher, LibAsset} from "../../interfaces/IAssetMatcher.sol";
import {IAssetMatcher, LibAsset} from "../interfaces/IAssetMatcher.sol";

contract TestAssetMatcher is IAssetMatcher {
function matchAssets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pragma solidity 0.8.21;

import {ERC1155Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {Royalties2981TestImpl} from "../../../royalties/mocks/Royalties2981TestImpl.sol";
import {LibRoyalties2981} from "../../../royalties/LibRoyalties2981.sol";
import {AbstractRoyalties, LibPart} from "../../../royalties/mocks/AbstractRoyalties.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {LibRoyalties2981} from "../royalties/LibRoyalties2981.sol";
import {AbstractRoyalties, LibPart} from "./AbstractRoyalties.sol";
import {Royalties2981TestImpl} from "./Royalties2981TestImpl.sol";

contract TestERC1155WithRoyaltyV2981 is
Initializable,
Expand All @@ -27,8 +27,13 @@ contract TestERC1155WithRoyaltyV2981 is
_saveRoyalties(tokenId, _fees);
}

function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == LibRoyalties2981._INTERFACE_ID_ROYALTIES;
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC1155Upgradeable, Royalties2981TestImpl) returns (bool) {
return
interfaceId == LibRoyalties2981._INTERFACE_ID_ROYALTIES ||
ERC1155Upgradeable.supportsInterface(interfaceId) ||
Royalties2981TestImpl.supportsInterface(interfaceId);
}

// solhint-disable-next-line no-empty-blocks
Expand Down
Loading

1 comment on commit e17fdfe

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

56.81%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/marketplace/contracts/exchange
   AssetMatcher.sol78.08%73.33%100%79.49%49–50, 50, 50–51, 53, 56, 59, 73–74, 74, 74–75, 77, 80–81
   Exchange.sol76.56%86.36%75%69.23%102, 109–112, 194, 53, 94, 94–96
   ExchangeCore.sol46.23%31.25%73.68%52.21%129–130, 145, 159–161, 168–169, 181, 196–197, 215–216, 216, 216, 216, 216, 218–219, 219, 219, 219, 219, 267, 267, 267–268, 268, 268–269, 269, 269, 271–272, 272, 272–273, 273, 273–274, 274, 274, 276, 278–279, 279, 279–280, 280, 280, 282, 309–310, 312–313, 370, 379–381, 381, 381–383, 383, 383–384, 384–386, 386, 386, 388, 390, 390, 390, 392, 403, 406–407, 411–412, 415, 438, 440–442, 448–450, 473–474, 491, 508–509, 509, 509–510, 512–513, 515, 522, 522, 522–523, 525, 525, 525–526, 528
   OrderValidator.sol69.81%57.14%100%80.95%32, 48, 55–56, 56, 56, 66, 76–77, 82, 84, 84, 84, 84–85, 87
   WhiteList.sol97.62%93.75%100%100%51
packages/marketplace/contracts/exchange/libraries
   LibDirectTransfer.sol100%100%100%100%
   LibFill.sol55%33.33%66.67%63.64%48–49, 61, 71–72, 72, 72–73
   LibOrderDataGeneric.sol21.67%22.22%40%18.92%18–28, 30–31, 33, 46, 48, 48, 48–49, 51–52, 55, 55, 55–56, 58, 61, 61, 61–62, 64, 67, 71, 73, 73, 73–75, 78, 87, 87, 87–89
packages/marketplace/contracts/interfaces
   IAssetMatcher.sol100%100%100%100%
   IOrderValidator.sol100%100%100%100%
   IRoyaltiesProvider.sol100%100%100%100%
   IWhiteList.sol100%100%100%100%
packages/marketplace/contracts/lazy-mint/erc-1155
   IERC1155LazyMint.sol100%100%100%100%
   LibERC1155LazyMint.sol0%100%0%0%34–36, 38–40, 42
packages/marketplace/contracts/lazy-mint/erc-721
   IERC721LazyMint.sol100%100%100%100%
   LibERC721LazyMint.sol0%100%0%0%33–35, 37–39, 41
packages/marketplace/contracts/lib-asset
   LibAsset.sol100%100%100%100%
packages/marketplace/contracts/lib-bp
   BpLibrary.sol100%100%100%100%
packages/marketplace/contracts/lib-order
   LibMath.sol27.50%18.75%50%30%100–103, 17–18, 33–34, 50, 50, 50–51, 72, 72, 72–73, 75, 88, 88, 88–89, 93, 93, 93, 93, 93, 97
   LibOrder.sol66.67%50%100%72.73%105, 105, 107, 107, 41–43, 54, 66
   LibOrderData.sol100%100%100%100%
packages/marketplace/contracts/lib-part
   LibPart.sol0%100%0%0%21
packages/marketplace/contracts/royalties
   IERC2981.sol100%100%100%100%
   LibRoyalties2981.sol35.71%25%100%33.33%19, 22–23, 23, 23–27
packages/marketplace/contracts/royalties-registry
   IMultiRoyaltyRecipients.sol100%100%100%100%
   RoyaltiesRegistry.sol69.92%67.65%92.86%66.67%154, 160, 160, 160–161, 164, 164, 164–165, 168, 196–197, 206, 210, 226–227, 230–238, 241, 241, 241–242, 244, 250, 253, 267–268, 270, 54
packages/marketplace/contracts/transfer-manager
   TransferExecutor.sol27.18%21.74%80%26.92%102, 105–106, 111–112, 112, 112–113, 113, 113–114, 116, 119–120, 125–126, 126, 126–127, 135, 145–146, 150, 160, 194, 194, 194–195, 195, 195–196, 200–201, 201–202, 206, 52–54, 61–62, 62, 62, 66, 69–70, 74, 74–75, 75, 75–76, 78, 78, 80–82, 84, 90, 90, 90–91, 91, 91–92, 92, 92, 95–96, 96, 96–97, 97, 97
   TransferManager.sol69.14%54.84%100%74%117, 121–122, 160–162, 162, 162–163, 169–170, 205–207, 207, 207–208, 208, 208–209, 215–216, 216, 216–217, 221, 235–236, 240–242, 246, 273, 290, 294–296, 296, 296–298, 303–304, 319–320, 324, 324, 324–325, 348, 352–353, 84–85
packages/marketplace/contracts/transfer-manager/interfaces
   IRoyaltyUGC.sol100%100%100%100%
   ITransferExecutor.sol100%100%100%100%
   ITransferManager.sol100%100%100%100%
packages/marketplace/contracts/transfer-manager/lib
   LibDeal.sol100%100%100%100%
   LibFeeSide.sol46.15%41.67%100%46.15%15–16,

Please sign in to comment.