Skip to content

Commit

Permalink
Merge pull request #101 from perpetual-protocol/hoxfix/v2.8.3
Browse files Browse the repository at this point in the history
Hoxfix/v2.8.3
  • Loading branch information
tailingchen committed Sep 12, 2023
2 parents 93cdf88 + 2e31d98 commit ca25f8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [2.8.3] - 2023-09-09
- Add tick checking when swap

## [2.8.2] - 2023-08-15

### Changed
Expand Down
8 changes: 4 additions & 4 deletions contracts/Exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ contract Exchange is
//
// STRUCT
//

struct InternalSwapResponse {
int256 base;
int256 quote;
Expand All @@ -74,7 +73,6 @@ contract Exchange is
//
// CONSTANT
//

uint256 internal constant _FULLY_CLOSED_RATIO = 1e18;
uint24 internal constant _MAX_TICK_CROSSED_WITHIN_BLOCK_CAP = 1000; // 10%
uint24 internal constant _MAX_PRICE_SPREAD_RATIO = 0.1e6; // 10% in decimal 6
Expand All @@ -83,7 +81,6 @@ contract Exchange is
//
// EXTERNAL NON-VIEW
//

function initialize(
address marketRegistryArg,
address orderBookArg,
Expand Down Expand Up @@ -426,6 +423,10 @@ contract Exchange is
)
);

int24 tick = UniswapV3Broker.getTick(marketInfo.pool);
// tick mismatch
require(tick == replayResponse.tick, "EX_TKMM");

// avoid stack too deep
{
// check price band after swap
Expand Down Expand Up @@ -521,7 +522,6 @@ contract Exchange is
//
// INTERNAL VIEW
//

function _getSqrtMarketTwapX96(address baseToken, uint32 twapInterval) internal view returns (uint160) {
return UniswapV3Broker.getSqrtMarketTwapX96(IMarketRegistry(_marketRegistry).getPool(baseToken), twapInterval);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perp/curie-contract",
"version": "2.8.2",
"version": "2.8.3",
"description": "Perpetual Protocol Curie (V2) core contracts",
"license": "GPL-3.0-or-later",
"author": {
Expand Down

0 comments on commit ca25f8e

Please sign in to comment.