Skip to content

Commit

Permalink
tests: fix triggerSpotOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Jul 17, 2024
1 parent 391e25a commit 798e6ef
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/triggerSpotOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
User,
Wallet,
OrderTriggerCondition,
getTriggerMarketOrderParams,
getTriggerMarketOrderParams, OracleGuardRails,
} from '../sdk/src';

import {
Expand All @@ -24,7 +24,7 @@ import {
initializeQuoteSpotMarket,
initializeSolSpotMarket,
} from './testHelpers';
import { BASE_PRECISION, isVariant, OracleSource } from '../sdk';
import {BASE_PRECISION, isVariant, OracleSource, PERCENTAGE_PRECISION} from '../sdk';
import { startAnchor } from 'solana-bankrun';
import { TestBulkAccountLoader } from '../sdk/src/accounts/testBulkAccountLoader';
import { BankrunContextWrapper } from '../sdk/src/bankrun/bankrunConnection';
Expand Down Expand Up @@ -110,6 +110,21 @@ describe('trigger orders', () => {
await initializeSolSpotMarket(fillerDriftClient, solUsd);
await fillerDriftClient.updateSpotAuctionDuration(0);

const oracleGuardRails: OracleGuardRails = {
priceDivergence: {
markOraclePercentDivergence: PERCENTAGE_PRECISION.mul(new BN(10)),
oracleTwap5MinPercentDivergence: PERCENTAGE_PRECISION.mul(new BN(10)),
},
validity: {
slotsBeforeStaleForAmm: new BN(100),
slotsBeforeStaleForMargin: new BN(100),
confidenceIntervalMaxSize: new BN(100000),
tooVolatileRatio: new BN(55), // allow 55x change
},
};

await fillerDriftClient.updateOracleGuardRails(oracleGuardRails);

const periodicity = new BN(60 * 60); // 1 HOUR

await fillerDriftClient.initializePerpMarket(
Expand Down

0 comments on commit 798e6ef

Please sign in to comment.