@triadxyz/triad-protocol 4.2.6 → 4.2.7
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/dist/trade.js +4 -6
- package/package.json +1 -1
package/dist/trade.js
CHANGED
|
@@ -220,7 +220,6 @@ class Trade {
|
|
|
220
220
|
if (usdcAmount.lte(new bn_js_1.default(0)))
|
|
221
221
|
continue;
|
|
222
222
|
const oppositeOrderDirection = (0, helpers_1.getOppositeOrderDirectionEncoded)(orderDirection);
|
|
223
|
-
const oppositePredictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), customer.id);
|
|
224
223
|
ixs.push(yield this.program.methods
|
|
225
224
|
.marketBidOrder({
|
|
226
225
|
amount: new bn_js_1.default(usdcAmount),
|
|
@@ -233,13 +232,13 @@ class Trade {
|
|
|
233
232
|
signer: this.program.provider.publicKey,
|
|
234
233
|
payer: this.rpcOptions.payer,
|
|
235
234
|
predictor: predictorPDA,
|
|
236
|
-
oppositePredictor:
|
|
235
|
+
oppositePredictor: new web3_js_1.PublicKey(order.authority),
|
|
237
236
|
central: (0, pda_1.getCentralPDA)(this.program.programId),
|
|
238
237
|
market: marketPDA,
|
|
239
238
|
orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
|
|
240
239
|
customer: customer.address,
|
|
241
240
|
predictorOrder: (0, pda_1.getPredictorOrderPDA)(this.program.programId, predictorPDA, marketId, (0, helpers_1.getOrderDirection)(orderDirection)),
|
|
242
|
-
oppositePredictorOrder: (0, pda_1.getPredictorOrderPDA)(this.program.programId,
|
|
241
|
+
oppositePredictorOrder: (0, pda_1.getPredictorOrderPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), marketId, (0, helpers_1.getOrderDirection)(oppositeOrderDirection))
|
|
243
242
|
})
|
|
244
243
|
.instruction());
|
|
245
244
|
remainingUSDC = remainingUSDC.sub(usdcAmount);
|
|
@@ -286,7 +285,6 @@ class Trade {
|
|
|
286
285
|
const effectivePriceDecimal = (0, feeCalculator_1.applySellFee)(orderPrice.toNumber() / 1000000, 500, customer.marketFeeBps);
|
|
287
286
|
const adjustedPrice = new bn_js_1.default(Math.floor(effectivePriceDecimal * 1000000));
|
|
288
287
|
amountOfUSDC = amountOfUSDC.add(sharesToSell.mul(adjustedPrice).div(new bn_js_1.default(Math.pow(10, constants_1.BASE_DECIMALS))));
|
|
289
|
-
const oppositePredictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), customer.id);
|
|
290
288
|
ixs.push(yield this.program.methods
|
|
291
289
|
.marketAskOrder({
|
|
292
290
|
shares: new bn_js_1.default(sharesToSell),
|
|
@@ -296,13 +294,13 @@ class Trade {
|
|
|
296
294
|
.accounts({
|
|
297
295
|
signer: this.program.provider.publicKey,
|
|
298
296
|
predictor: predictorPDA,
|
|
299
|
-
oppositePredictor:
|
|
297
|
+
oppositePredictor: new web3_js_1.PublicKey(order.authority),
|
|
300
298
|
market: marketPDA,
|
|
301
299
|
orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
|
|
302
300
|
customer: customer.address,
|
|
303
301
|
central: (0, pda_1.getCentralPDA)(this.program.programId),
|
|
304
302
|
predictorOrder: (0, pda_1.getPredictorOrderPDA)(this.program.programId, predictorPDA, marketId, (0, helpers_1.getOrderDirection)(orderDirection)),
|
|
305
|
-
oppositePredictorOrder: (0, pda_1.getPredictorOrderPDA)(this.program.programId,
|
|
303
|
+
oppositePredictorOrder: (0, pda_1.getPredictorOrderPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), marketId, (0, helpers_1.getOrderDirection)(orderDirection))
|
|
306
304
|
})
|
|
307
305
|
.instruction());
|
|
308
306
|
}
|