import * as anchor from '@project-serum/anchor' ; import { Program } from '@project-serum/anchor' ; import { Keypair } from '@solana/web3.js' ; import BN from 'bn.js' ; import { Admin , PEG_PRECISION } from '../sdk/src' ; import { mockUSDCMint } from '../stress/mockAccounts' ; import { stress_test } from '../stress/stress' ; describe ( 'stress-test' , ( ) => { const provider = anchor . Provider . local ( ) ; const connection = provider . connection ; anchor . setProvider ( provider ) ; const chProgram = anchor . workspace . ClearingHouse as Program ; let usdcMint ; const clearingHouse = Admin . from ( connection , provider . wallet , chProgram . programId ) ; before ( async ( ) => { usdcMint = await mockUSDCMint ( provider ) ; await clearingHouse . initialize ( usdcMint . publicKey , true ) ; await clearingHouse . subscribe ( ) ; } ) ; after ( async ( ) => { await clearingHouse . unsubscribe ( ) ; } ) ; it ( 'test-repeg-peg=150' , async ( ) => { const pegM = new BN ( 150 ) . mul ( PEG_PRECISION ) ; await stress_test ( clearingHouse , usdcMint , provider , 1 , 100 , 10000 * 10 ** 11 , 10 ** 13 , undefined , [ pegM , pegM ] , undefined , undefined , 'sim-slipfee-rand1-test' ) ; } ) ; } ) ;