Skip to content

feat: add simple tests + minor changes on the core contracts#2

Merged
Pybast merged 3 commits intomainfrom
feat/simple-tests
Sep 21, 2025
Merged

feat: add simple tests + minor changes on the core contracts#2
Pybast merged 3 commits intomainfrom
feat/simple-tests

Conversation

@Pybast
Copy link
Contributor

@Pybast Pybast commented Sep 20, 2025

No description provided.

Copy link
Contributor

@Intermarch3 Intermarch3 left a comment

Choose a reason for hiding this comment

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

I think we need to change some verification about the Polymarket order status.

As Polymarket posts the order on-chain only when matched, the current verification looks if the isFilledOrCancelled var is false AND remaining not equal to 0, but as the order is not on-chain at the beginning, the remaining var is uninitialized so equal to 0.

Comment on lines +524 to +558
// // ===== INVARIANT TESTS =====

// /**
// * @dev Invariant: Valid orders should always produce valid GPv2Orders
// */
// function invariantValidOrderProducesValidGPv2Order() public {
// mockPolymarket.setOrderStatus(TEST_ORDER_HASH, false, 100);

// PolyswapOrder.Data memory order = _createTestOrder();
// GPv2Order.Data memory gpv2Order = PolyswapOrder.orderFor(order, Trading(address(mockPolymarket)));

// // Invariant checks
// assertTrue(address(gpv2Order.sellToken) != address(0), "Sell token should not be zero");
// assertTrue(address(gpv2Order.buyToken) != address(0), "Buy token should not be zero");
// assertTrue(gpv2Order.sellAmount > 0, "Sell amount should be positive");
// assertTrue(gpv2Order.buyAmount > 0, "Buy amount should be positive");
// assertTrue(gpv2Order.validTo > block.timestamp, "Order should not be expired");
// assertEq(gpv2Order.kind, GPv2Order.KIND_SELL, "Should be sell order");
// assertFalse(gpv2Order.partiallyFillable, "Should not be partially fillable");
// }

// /**
// * @dev Invariant: Fulfilled Polymarket orders should always allow order execution
// */
// function invariantFulfilledPolymarketOrderAllowsExecution() public {
// // Setup fulfilled Polymarket order
// mockPolymarket.setOrderStatus(TEST_ORDER_HASH, true, 0);

// PolyswapOrder.Data memory order = _createTestOrder();

// // Should not revert
// GPv2Order.Data memory gpv2Order =
// polyswap.getTradeableOrder(address(testSafe), address(this), bytes32(0), abi.encode(order), bytes(""));

// // Invariant: returned order should match input parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these tests commented ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these tests are unnecessary, removed them

@Pybast Pybast merged commit 8983be8 into main Sep 21, 2025
2 checks passed
@Pybast Pybast deleted the feat/simple-tests branch September 21, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants