feat: add simple tests + minor changes on the core contracts#2
Merged
Conversation
Intermarch3
approved these changes
Sep 20, 2025
Contributor
Intermarch3
left a comment
There was a problem hiding this comment.
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.
test/PolyswapTest.t.sol
Outdated
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 |
Contributor
There was a problem hiding this comment.
Why are these tests commented ?
Contributor
Author
There was a problem hiding this comment.
these tests are unnecessary, removed them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.