Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
doublesharp committed Jan 20, 2024
1 parent 996e9e1 commit 908fbaf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contracts/SamWitchOrderBook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract SamWitchOrderBook is ISamWitchOrderBook, ERC1155Holder, UUPSUpgradeable
bytes32 private constant CANCEL_ORDERS_HASH =
keccak256(
abi.encodePacked(
"cancelOrders(address sender,uint256 nonce,uint256 deadline,uint256[] orderIds,CancelOrder[] cancelOrderInfos)",
"cancelOrders(address sender,uint256 nonce,uint256 deadline,uint256[] orderIds,CancelOrder[] orders)",
"CancelOrder(uint8 side,uint256 tokenId,uint72 price)"
)
);
Expand Down
20 changes: 10 additions & 10 deletions test/SamWitchOrderBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ describe("SamWitchOrderBook", function () {
const nonce = await orderBook.nonces(sender);

const orderIds = [1];
const cancelOrderInfos: ISamWitchOrderBook.CancelOrderStruct[] = [{side: OrderSide.Buy, tokenId, price}];
const orderInfos: ISamWitchOrderBook.CancelOrderStruct[] = [{side: OrderSide.Buy, tokenId, price}];

const cancelOrdersRequest = {
domain: {
Expand Down Expand Up @@ -366,7 +366,7 @@ describe("SamWitchOrderBook", function () {
type: "uint256[]",
},
{
name: "cancelOrderInfos",
name: "orders",
type: "CancelOrder[]",
},
],
Expand All @@ -391,7 +391,7 @@ describe("SamWitchOrderBook", function () {
nonce,
deadline,
orderIds,
cancelOrderInfos,
orders: orderInfos,
},
};

Expand All @@ -411,7 +411,7 @@ describe("SamWitchOrderBook", function () {
nonce,
deadline,
orderIds,
cancelOrderInfos,
orderInfos,
);
});

Expand Down Expand Up @@ -558,17 +558,17 @@ describe("SamWitchOrderBook", function () {

// Cancel a buy in the middle
let orderIds = [9, 10, 11, 12];
let cancelOrderInfos = orderIds.map(() => ({side: OrderSide.Buy, tokenId, price}));
await orderBook.cancelOrders(orderIds, cancelOrderInfos);
let orderInfos = orderIds.map(() => ({side: OrderSide.Buy, tokenId, price}));
await orderBook.cancelOrders(orderIds, orderInfos);
// Cancel a buy at the start
orderIds = [1, 2, 3, 4];
cancelOrderInfos = orderIds.map(() => ({side: OrderSide.Buy, tokenId, price}));
await orderBook.cancelOrders(orderIds, cancelOrderInfos);
orderInfos = orderIds.map(() => ({side: OrderSide.Buy, tokenId, price}));
await orderBook.cancelOrders(orderIds, orderInfos);

// Cancel a buy at the end
orderIds = [13, 14, 15, 16];
cancelOrderInfos = orderIds.map(() => ({side: OrderSide.Buy, tokenId, price}));
await orderBook.cancelOrders(orderIds, cancelOrderInfos);
orderInfos = orderIds.map(() => ({side: OrderSide.Buy, tokenId, price}));
await orderBook.cancelOrders(orderIds, orderInfos);

// The only one left should be orderIds
orderIds = [5, 6, 7, 8];
Expand Down

0 comments on commit 908fbaf

Please sign in to comment.