diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 849b7217..93e7bdee 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.39 +current_version = 0.7.40 commit = True tag = True tag_name = {new_version} diff --git a/CHANGELOG.md b/CHANGELOG.md index 98d3dd23..7b832b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -202,4 +202,10 @@ Add max confidence interval multiplier to oracle validity calculations ## [0.7.39] - 2024-3-13 -Fix events archiver bug with logs less than 8 bytes \ No newline at end of file +Fix events archiver bug with logs less than 8 bytes + +## [0.7.40] - 2024-3-14 + +Update `drift.json` IDL + +Fix enum interpretaton bug in `get_max_confidence_interval_multiplier` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6f71f50b..58b244b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "driftpy" -version = "0.7.39" +version = "0.7.40" description = "A Python client for the Drift DEX" authors = ["x19 ", "bigz ", "frank "] license = "MIT" diff --git a/src/driftpy/__init__.py b/src/driftpy/__init__.py index 58f75979..9cbc96b8 100644 --- a/src/driftpy/__init__.py +++ b/src/driftpy/__init__.py @@ -1 +1 @@ -__version__ = "0.7.39" +__version__ = "0.7.40" diff --git a/src/driftpy/idl/drift.json b/src/driftpy/idl/drift.json index 627cdec1..9a439ad4 100644 --- a/src/driftpy/idl/drift.json +++ b/src/driftpy/idl/drift.json @@ -1,5 +1,5 @@ { - "version": "2.70.0", + "version": "2.72.0", "name": "drift", "instructions": [ { @@ -3336,6 +3336,32 @@ } ] }, + { + "name": "updatePerpMarketFundingPeriod", + "accounts": [ + { + "name": "admin", + "isMut": false, + "isSigner": true + }, + { + "name": "state", + "isMut": false, + "isSigner": false + }, + { + "name": "perpMarket", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "fundingPeriod", + "type": "i64" + } + ] + }, { "name": "updatePerpMarketMaxImbalances", "accounts": [ @@ -4967,6 +4993,11 @@ "isMut": true, "isSigner": false }, + { + "name": "perpMarket", + "isMut": true, + "isSigner": false + }, { "name": "state", "isMut": false, @@ -4981,6 +5012,37 @@ } } ] + }, + { + "name": "deletePrelaunchOracle", + "accounts": [ + { + "name": "admin", + "isMut": true, + "isSigner": true + }, + { + "name": "prelaunchOracle", + "isMut": true, + "isSigner": false + }, + { + "name": "perpMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "state", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "perpMarketIndex", + "type": "u16" + } + ] } ], "accounts": [ @@ -8560,6 +8622,9 @@ }, { "name": "UpdateAMMCurve" + }, + { + "name": "OracleOrderPrice" } ] } diff --git a/src/driftpy/math/oracles.py b/src/driftpy/math/oracles.py index 54c5f104..76625060 100644 --- a/src/driftpy/math/oracles.py +++ b/src/driftpy/math/oracles.py @@ -104,8 +104,12 @@ def is_oracle_valid( is_oracle_price_too_volatile = lhs or rhs + print(market.contract_tier) max_confidence_multiplier = get_max_confidence_interval_multiplier(market) + print(oracle_guard_rails.validity.confidence_interval_max_size) + print(max_confidence_multiplier) + is_confidence_too_large = ( (max(1, oracle_price_data.confidence) * BID_ASK_SPREAD_PRECISION) // oracle_price_data.price @@ -128,14 +132,13 @@ def is_oracle_valid( def get_max_confidence_interval_multiplier(market: PerpMarketAccount) -> int: - match market.contract_tier: - case ContractTier.A(): - return 1 - case ContractTier.B(): - return 1 - case ContractTier.C(): - return 2 - case ContractTier.Speculative(): - return 10 - case ContractTier.Isolated(): - return 50 + if str(market.contract_tier) == "ContractTier.A()": + return 1 + elif str(market.contract_tier) == "ContractTier.B()": + return 1 + elif str(market.contract_tier) == "ContractTier.C()": + return 2 + elif str(market.contract_tier) == "ContractTier.Speculative()": + return 10 + elif str(market.contract_tier) == "ContractTier.Isolated()": + return 50