@@ -57,11 +57,7 @@ export class Balance {
5757 this . storage = { } ;
5858 }
5959
60- public init (
61- balance : BN ,
62- weightAMM : BN ,
63- storage : { [ key : number ] : Storage }
64- ) {
60+ public init ( balance : BN , weightAMM : BN , storage : { [ key : number ] : Storage } ) {
6561 this . balance = new BN ( balance . toString ( 10 ) ) ;
6662 this . weightAMM = new BN ( weightAMM . toString ( 10 ) ) ;
6763 this . storage = storage ;
@@ -178,9 +174,7 @@ export class Simulator {
178174 const jBalance = jAccount . _balancesLeafs [ balanceKey ] ;
179175
180176 const storage : { [ key : number ] : Storage } = { } ;
181- const storageKeys : string [ ] = Object . keys (
182- jBalance . _storageLeafs
183- ) ;
177+ const storageKeys : string [ ] = Object . keys ( jBalance . _storageLeafs ) ;
184178 for ( const storageKey of storageKeys ) {
185179 const jStorage = jBalance . _storageLeafs [ storageKey ] ;
186180 storage [ Number ( storageKey ) ] = {
@@ -322,7 +316,11 @@ export class Simulator {
322316 "pubKeyY does not match"
323317 ) ;
324318 assert . equal ( accountA . nonce , accountB . nonce , "nonce does not match" ) ;
325- assert . equal ( accountA . feeBipsAMM , accountB . feeBipsAMM , "feeBipsAMM does not match" ) ;
319+ assert . equal (
320+ accountA . feeBipsAMM ,
321+ accountB . feeBipsAMM ,
322+ "feeBipsAMM does not match"
323+ ) ;
326324 }
327325
328326 public static executeBlock (
@@ -504,6 +502,7 @@ export class Simulator {
504502 update : AccountUpdate
505503 ) {
506504 const account = state . getAccount ( update . accountID ) ;
505+ account . owner = update . owner ;
507506 account . publicKeyX = update . publicKeyX ;
508507 account . publicKeyY = update . publicKeyY ;
509508 account . nonce ++ ;
@@ -554,7 +553,9 @@ export class Simulator {
554553 from . getBalance ( transfer . feeTokenID ) . balance . isub ( transfer . fee ) ;
555554
556555 // Nonce
557- const storage = from . getBalance ( transfer . tokenID ) . getStorage ( transfer . storageID ) ;
556+ const storage = from
557+ . getBalance ( transfer . tokenID )
558+ . getStorage ( transfer . storageID ) ;
558559 storage . data = new BN ( 1 ) ;
559560 storage . storageID = transfer . storageID ;
560561
@@ -581,19 +582,17 @@ export class Simulator {
581582 amount = new BN ( 0 ) ;
582583 }
583584 account . getBalance ( withdrawal . tokenID ) . balance . isub ( amount ) ;
584- account
585- . getBalance ( withdrawal . feeTokenID )
586- . balance . isub ( withdrawal . fee ) ;
585+ account . getBalance ( withdrawal . feeTokenID ) . balance . isub ( withdrawal . fee ) ;
587586
588587 const operator = state . getAccount ( block . operatorAccountID ) ;
589- operator
590- . getBalance ( withdrawal . feeTokenID )
591- . balance . iadd ( withdrawal . fee ) ;
588+ operator . getBalance ( withdrawal . feeTokenID ) . balance . iadd ( withdrawal . fee ) ;
592589
593590 if ( withdrawal . type === 0 || withdrawal . type === 1 ) {
594591 // Nonce
595592 const storageSlot = withdrawal . storageID % Constants . NUM_STORAGE_SLOTS ;
596- const storage = account . getBalance ( withdrawal . tokenID ) . getStorage ( storageSlot ) ;
593+ const storage = account
594+ . getBalance ( withdrawal . tokenID )
595+ . getStorage ( storageSlot ) ;
597596 storage . storageID = withdrawal . storageID ;
598597 storage . data = new BN ( 1 ) ;
599598 }
@@ -907,7 +906,8 @@ export class Simulator {
907906 . isub ( s . feeA ) ;
908907
909908 const tradeHistoryA = accountA . getBalance ( tokenA ) . getStorage ( storageIdA ) ;
910- tradeHistoryA . data = storageIdA > tradeHistoryA . storageID ? new BN ( 0 ) : tradeHistoryA . data ;
909+ tradeHistoryA . data =
910+ storageIdA > tradeHistoryA . storageID ? new BN ( 0 ) : tradeHistoryA . data ;
911911 tradeHistoryA . data . iadd ( fillAmountBorSA ? s . fillBA : s . fillSA ) ;
912912 tradeHistoryA . storageID = storageIdA ;
913913 }
@@ -921,7 +921,8 @@ export class Simulator {
921921 . isub ( s . feeB ) ;
922922
923923 const tradeHistoryB = accountB . getBalance ( tokenB ) . getStorage ( storageIdB ) ;
924- tradeHistoryB . data = storageIdB > tradeHistoryB . storageID ? new BN ( 0 ) : tradeHistoryB . data ;
924+ tradeHistoryB . data =
925+ storageIdB > tradeHistoryB . storageID ? new BN ( 0 ) : tradeHistoryB . data ;
925926 tradeHistoryB . data . iadd ( fillAmountBorSB ? s . fillBB : s . fillSB ) ;
926927 tradeHistoryB . storageID = storageIdB ;
927928 }
@@ -1074,8 +1075,10 @@ export class Simulator {
10741075 . getBalance ( order . tokenIdS )
10751076 . getStorage ( order . storageID ) ;
10761077 // Trade history trimming
1077- const leafStorageID = tradeHistory . storageID === 0 ? storageSlot : tradeHistory . storageID ;
1078- const filled = leafStorageID === order . storageID ? tradeHistory . data : new BN ( 0 ) ;
1078+ const leafStorageID =
1079+ tradeHistory . storageID === 0 ? storageSlot : tradeHistory . storageID ;
1080+ const filled =
1081+ leafStorageID === order . storageID ? tradeHistory . data : new BN ( 0 ) ;
10791082 return filled ;
10801083 }
10811084
0 commit comments