@@ -384,16 +384,17 @@ describe("autocrat_v0", async function () {
384384 quotePassConditionalTokenMint ,
385385 alice . publicKey
386386 ) ;
387- aliceQuoteFailConditionalTokenAccount = await createAssociatedTokenAccount (
388- banksClient ,
389- payer ,
390- quoteFailConditionalTokenMint ,
391- alice . publicKey
392- ) ;
387+ aliceQuoteFailConditionalTokenAccount =
388+ await createAssociatedTokenAccount (
389+ banksClient ,
390+ payer ,
391+ quoteFailConditionalTokenMint ,
392+ alice . publicKey
393+ ) ;
393394
394395 await mintConditionalTokens (
395396 vaultProgram ,
396- 10_000 * 1_000_000 ,
397+ 10_000n * 1_000_000n ,
397398 alice ,
398399 quoteVault ,
399400 banksClient
@@ -485,8 +486,12 @@ describe("autocrat_v0", async function () {
485486 selfTradeBehavior : SelfTradeBehavior . DecrementTake ,
486487 limit : 255 ,
487488 } ;
488- const storedPassMarket = await openbook . getMarket ( openbookPassMarket ) ;
489- const storedFailMarket = await openbook . getMarket ( openbookFailMarket ) ;
489+ const storedPassMarket = await openbook . getMarketAccount (
490+ openbookPassMarket
491+ ) ;
492+ const storedFailMarket = await openbook . getMarketAccount (
493+ openbookFailMarket
494+ ) ;
490495
491496 let currentClock ;
492497 for ( let i = 0 ; i < 10 ; i ++ ) {
@@ -557,19 +562,18 @@ describe("autocrat_v0", async function () {
557562 } )
558563 . signers ( [ mm0 . keypair ] )
559564 . rpc ( ) ;
560- currentClock = await context . banksClient . getClock ( ) ;
561- context . setClock (
562- new Clock (
563- currentClock . slot + 10_000n ,
564- currentClock . epochStartTimestamp ,
565- currentClock . epoch ,
566- currentClock . leaderScheduleEpoch ,
567- currentClock . unixTimestamp
568- )
569- ) ;
565+ currentClock = await context . banksClient . getClock ( ) ;
566+ context . setClock (
567+ new Clock (
568+ currentClock . slot + 10_000n ,
569+ currentClock . epochStartTimestamp ,
570+ currentClock . epoch ,
571+ currentClock . leaderScheduleEpoch ,
572+ currentClock . unixTimestamp
573+ )
574+ ) ;
570575 }
571576
572-
573577 // set the current clock slot to +10_000
574578 currentClock = await context . banksClient . getClock ( ) ;
575579 context . setClock (
@@ -769,8 +773,15 @@ describe("autocrat_v0", async function () {
769773 ) ;
770774
771775 // alice should have gained 1 META & lost 0.11 USDC
772- assert . equal ( ( await getAccount ( banksClient , aliceUnderlyingBaseTokenAccount ) ) . amount , 1_000_000_000n ) ;
773- assert . equal ( ( await getAccount ( banksClient , aliceUnderlyingQuoteTokenAccount ) ) . amount , ( 10_000n * 1_000_000n ) - 110_000n ) ;
776+ assert . equal (
777+ ( await getAccount ( banksClient , aliceUnderlyingBaseTokenAccount ) ) . amount ,
778+ 1_000_000_000n
779+ ) ;
780+ assert . equal (
781+ ( await getAccount ( banksClient , aliceUnderlyingQuoteTokenAccount ) )
782+ . amount ,
783+ 10_000n * 1_000_000n - 110_000n
784+ ) ;
774785 } ) ;
775786
776787 it ( "rejects proposals when pass price TWAP < fail price TWAP" , async function ( ) {
@@ -810,7 +821,7 @@ describe("autocrat_v0", async function () {
810821 selfTradeBehavior : SelfTradeBehavior . DecrementTake ,
811822 limit : 255 ,
812823 } ;
813-
824+
814825 let failSellArgs : PlaceOrderArgs = {
815826 side : Side . Ask ,
816827 priceLots : new BN ( 3200 ) , // 0.32 USDC for 1 META
@@ -822,8 +833,12 @@ describe("autocrat_v0", async function () {
822833 selfTradeBehavior : SelfTradeBehavior . DecrementTake ,
823834 limit : 255 ,
824835 } ;
825- const storedPassMarket = await openbook . getMarket ( openbookPassMarket ) ;
826- const storedFailMarket = await openbook . getMarket ( openbookFailMarket ) ;
836+ const storedPassMarket = await openbook . getMarketAccount (
837+ openbookPassMarket
838+ ) ;
839+ const storedFailMarket = await openbook . getMarketAccount (
840+ openbookFailMarket
841+ ) ;
827842
828843 let currentClock ;
829844 for ( let i = 0 ; i < 10 ; i ++ ) {
@@ -894,19 +909,18 @@ describe("autocrat_v0", async function () {
894909 } )
895910 . signers ( [ mm0 . keypair ] )
896911 . rpc ( ) ;
897- currentClock = await context . banksClient . getClock ( ) ;
898- context . setClock (
899- new Clock (
900- currentClock . slot + 10_000n ,
901- currentClock . epochStartTimestamp ,
902- currentClock . epoch ,
903- currentClock . leaderScheduleEpoch ,
904- currentClock . unixTimestamp
905- )
906- ) ;
912+ currentClock = await context . banksClient . getClock ( ) ;
913+ context . setClock (
914+ new Clock (
915+ currentClock . slot + 10_000n ,
916+ currentClock . epochStartTimestamp ,
917+ currentClock . epoch ,
918+ currentClock . leaderScheduleEpoch ,
919+ currentClock . unixTimestamp
920+ )
921+ ) ;
907922 }
908923
909-
910924 // set the current clock slot to +10_000
911925 currentClock = await context . banksClient . getClock ( ) ;
912926 context . setClock (
@@ -1109,8 +1123,15 @@ describe("autocrat_v0", async function () {
11091123 ) ;
11101124
11111125 // alice should have the same balance as she started with
1112- assert . equal ( ( await getAccount ( banksClient , aliceUnderlyingBaseTokenAccount ) ) . amount , 0n ) ;
1113- assert . equal ( ( await getAccount ( banksClient , aliceUnderlyingQuoteTokenAccount ) ) . amount , 10_000n * 1_000_000n ) ;
1126+ assert . equal (
1127+ ( await getAccount ( banksClient , aliceUnderlyingBaseTokenAccount ) ) . amount ,
1128+ 0n
1129+ ) ;
1130+ assert . equal (
1131+ ( await getAccount ( banksClient , aliceUnderlyingQuoteTokenAccount ) )
1132+ . amount ,
1133+ 10_000n * 1_000_000n
1134+ ) ;
11141135 } ) ;
11151136 } ) ;
11161137} ) ;
@@ -1127,8 +1148,8 @@ async function generateMarketMaker(
11271148) : Promise < MarketMaker > {
11281149 const mm = anchor . web3 . Keypair . generate ( ) ;
11291150
1130- const storedPassMarket = await openbook . getMarket ( passMarket ) ;
1131- const storedFailMarket = await openbook . getMarket ( failMarket ) ;
1151+ const storedPassMarket = await openbook . getMarketAccount ( passMarket ) ;
1152+ const storedFailMarket = await openbook . getMarketAccount ( failMarket ) ;
11321153
11331154 const metaPassAcc = await createAccount (
11341155 banksClient ,
0 commit comments