Skip to content

Commit

Permalink
feat: added type to Bundle componets in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
capedcrusader21 committed Sep 12, 2024
1 parent b5e24af commit 51e71fb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
21 changes: 8 additions & 13 deletions packages/marketplace/test/exchange/Bundle.behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {
Asset,
AssetBundle,
LibPartData,
BundledERC721,
BundledERC1155,
Quads,
BundleData,
PriceDistribution,
} from '../utils/assets.ts';

Expand Down Expand Up @@ -38,15 +42,10 @@ export function shouldMatchOrdersForBundle() {
bundleWithoutERC721Left: Asset,
bundleWithoutERC721Right: Asset,
priceDistribution: PriceDistribution,
// TODO: types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bundledERC721: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bundledERC1155: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
quads: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bundleData: any,
bundledERC721: BundledERC721,
bundledERC1155: BundledERC1155,
quads: Quads,
bundleData: BundleData,
orderLeft: Order,
orderRight: Order,
makerSig: string,
Expand Down Expand Up @@ -269,8 +268,6 @@ export function shouldMatchOrdersForBundle() {
).to.be.equal(
(Number(protocolFeeSecondary) * Number(takerAsset.value)) / 10000
);

// TODO: royalties checks for tokens
});

it('should not allow asset bundle value > 1 if there are ERC721 contained in the bundle, since ERC721 are unique', async function () {
Expand Down Expand Up @@ -450,7 +447,6 @@ export function shouldMatchOrdersForBundle() {
expect(await ERC1155Contract.balanceOf(takerAddress, 1)).to.be.equal(
10
);
// TODO: royalties checks for tokens
});

it('should not allow signature reuse for partially filling orders using matchOrders between ERC20 and BUNDLE', async function () {
Expand Down Expand Up @@ -1813,7 +1809,6 @@ export function shouldMatchOrdersForBundle() {
expect(await ERC1155Contract.balanceOf(takerAddress, 1)).to.be.equal(
20
);
// TODO: royalties checks for tokens
});

it('should execute complete match order for bundle with royalty on Quads', async function () {
Expand Down
25 changes: 25 additions & 0 deletions packages/marketplace/test/utils/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ export type AssetType = {
data: BytesLike;
};

export type BundledERC721 = {
erc721Address: string;
ids: Numeric[];
};

export type BundledERC1155 = {
erc1155Address: string;
ids: Numeric[];
supplies: Numeric[];
};

export type Quads = {
sizes: Numeric[];
xs: Numeric[];
ys: Numeric[];
data: string;
};

export type BundleData = {
bundledERC721: BundledERC721[];
bundledERC1155: BundledERC1155[];
quads: Quads;
priceDistribution: PriceDistribution;
};

export type PriceDistribution = {
erc721Prices: Numeric[][];
erc1155Prices: Numeric[][];
Expand Down

1 comment on commit 51e71fb

@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

98.09%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/marketplace/contracts
   Exchange.sol94.52%93.33%94.44%96%126, 194, 72
   ExchangeCore.sol98.84%96.67%100%100%85
   OrderValidator.sol98.44%96.15%100%100%36
   RoyaltiesRegistry.sol96.32%88.89%100%98.78%194, 216–217, 263, 65
   TransferManager.sol95.28%86.11%100%99.30%163, 214, 224, 274, 418, 423, 434, 446–447, 458, 93
   Whitelist.sol75.81%60%85.71%82.14%104, 108–109, 122, 125, 141–142, 54, 66, 66–67, 71, 76
packages/marketplace/contracts/interfaces
   IOrderValidator.sol100%100%100%100%
   IRoyaltiesProvider.sol100%100%100%100%
   ITransferManager.sol100%100%100%100%
   IWhitelist.sol100%100%100%100%
packages/marketplace/contracts/libraries
   LibAsset.sol100%100%100%100%
   LibMath.sol100%100%100%100%
   LibOrder.sol100%100%100%100%

Please sign in to comment.