@drift-labs/sdk 2.70.0-beta.1 → 2.71.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/lib/idl/drift.json +1 -1
- package/lib/math/auction.js +7 -1
- package/package.json +1 -1
- package/src/idl/drift.json +1 -1
- package/src/math/auction.ts +8 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.71.0-beta.0
|
package/lib/idl/drift.json
CHANGED
package/lib/math/auction.js
CHANGED
|
@@ -95,7 +95,13 @@ function getAuctionPriceForOracleOffsetAuction(order, slot, oraclePrice) {
|
|
|
95
95
|
}
|
|
96
96
|
exports.getAuctionPriceForOracleOffsetAuction = getAuctionPriceForOracleOffsetAuction;
|
|
97
97
|
function deriveOracleAuctionParams({ direction, oraclePrice, auctionStartPrice, auctionEndPrice, limitPrice, }) {
|
|
98
|
-
let oraclePriceOffset
|
|
98
|
+
let oraclePriceOffset;
|
|
99
|
+
if (limitPrice.eq(_1.ZERO) || oraclePrice.eq(_1.ZERO)) {
|
|
100
|
+
oraclePriceOffset = _1.ZERO;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
oraclePriceOffset = limitPrice.sub(oraclePrice);
|
|
104
|
+
}
|
|
99
105
|
if (oraclePriceOffset.eq(_1.ZERO)) {
|
|
100
106
|
oraclePriceOffset = (0, types_1.isVariant)(direction, 'long')
|
|
101
107
|
? auctionEndPrice.sub(oraclePrice).add(_1.ONE)
|
package/package.json
CHANGED
package/src/idl/drift.json
CHANGED
package/src/math/auction.ts
CHANGED
|
@@ -127,7 +127,14 @@ export function deriveOracleAuctionParams({
|
|
|
127
127
|
auctionEndPrice: BN;
|
|
128
128
|
limitPrice: BN;
|
|
129
129
|
}): { auctionStartPrice: BN; auctionEndPrice: BN; oraclePriceOffset: number } {
|
|
130
|
-
let oraclePriceOffset
|
|
130
|
+
let oraclePriceOffset;
|
|
131
|
+
|
|
132
|
+
if (limitPrice.eq(ZERO) || oraclePrice.eq(ZERO)) {
|
|
133
|
+
oraclePriceOffset = ZERO;
|
|
134
|
+
} else {
|
|
135
|
+
oraclePriceOffset = limitPrice.sub(oraclePrice);
|
|
136
|
+
}
|
|
137
|
+
|
|
131
138
|
if (oraclePriceOffset.eq(ZERO)) {
|
|
132
139
|
oraclePriceOffset = isVariant(direction, 'long')
|
|
133
140
|
? auctionEndPrice.sub(oraclePrice).add(ONE)
|