@@ -43,7 +43,7 @@ const flowMarginProtocolSafetyContract = new web3.eth.Contract(
4343 flowMarginProtocolSafetyAddress ,
4444) ;
4545
46- const poolAddress = deployment . marginPool ;
46+ const poolAddress = deployment . marginPoolGeneral ;
4747const poolContract = new web3 . eth . Contract ( poolAbi as any , poolAddress ) ;
4848
4949const oracleAddress = deployment . oracle ;
@@ -61,7 +61,6 @@ const tokenStringToAddress = {
6161 EUR : deployment . fEUR ,
6262 JPY : deployment . fJPY ,
6363 AUX : deployment . fXAU ,
64- AAPL : deployment . fAAPL ,
6564} ;
6665
6766const accountOf = ( name : string ) : Account => {
@@ -101,7 +100,7 @@ const transferUsd = async (to: string, amount: BN): Promise<any> => {
101100const parseCurrency = ( amount : string ) : string => {
102101 const parsed = amount . replace ( 'F' , 'f' ) ;
103102
104- return deployment [ parsed as 'fEUR' | 'fJPY' | 'fXAU' | 'fAAPL' ] ;
103+ return deployment [ parsed as 'fEUR' | 'fJPY' | 'fXAU' ] ;
105104} ;
106105
107106const parseAmount = ( amount : string ) : BN => {
@@ -508,10 +507,10 @@ Then(
508507
509508 const swapRate = parseSwapRate ( additionalSwapRate ) ;
510509 const currentLongSwapRate = await flowMarginProtocolConfigContract . methods
511- . currentSwapRates ( baseAddress , quoteAddress , true )
510+ . currentSwapRates ( baseAddress , quoteAddress , '0' )
512511 . call ( ) ;
513512 const currentShortSwapRate = await flowMarginProtocolConfigContract . methods
514- . currentSwapRates ( baseAddress , quoteAddress , false )
513+ . currentSwapRates ( baseAddress , quoteAddress , '1' )
515514 . call ( ) ;
516515 const newLongSwapRate = new BN ( currentLongSwapRate ) . add ( swapRate ) ;
517516 const newShortwapRate = new BN ( currentShortSwapRate ) . add ( swapRate ) ;
@@ -728,6 +727,21 @@ Given('margin liquidity pool margin call', async (table: TableDefinition) => {
728727Then ( 'margin liquidity pool liquidate' , async ( table : TableDefinition ) => {
729728 for ( const [ result ] of table . rows ( ) ) {
730729 try {
730+ const enpThreshold = await flowMarginProtocolConfigContract . methods
731+ . liquidityPoolENPLiquidateThreshold ( )
732+ . call ( ) ;
733+ const ellThreshold = await flowMarginProtocolConfigContract . methods
734+ . liquidityPoolELLLiquidateThreshold ( )
735+ . call ( ) ;
736+ const enpAndEll = await flowMarginProtocolSafetyContract . methods
737+ . getEnpAndEll ( poolAddress )
738+ . call ( ) ;
739+ console . log ( {
740+ enp : enpAndEll [ '0' ] . toString ( ) ,
741+ ell : enpAndEll [ '1' ] . toString ( ) ,
742+ enpThreshold : enpThreshold . toString ( ) ,
743+ ellThreshold : ellThreshold . toString ( ) ,
744+ } ) ;
731745 await sendTx ( {
732746 contractMethod : flowMarginProtocolSafetyContract . methods . liquidateLiquidityPool (
733747 poolAddress ,
@@ -737,7 +751,11 @@ Then('margin liquidity pool liquidate', async (table: TableDefinition) => {
737751 if ( result !== 'Ok' )
738752 expect . fail ( `Pool liquidation call should have reverted, but didnt!` ) ;
739753
754+ console . log ( 'Before force close 1' ) ;
755+
740756 const alicePositionCount = await forceCloseForPool ( alice , 0 ) ;
757+
758+ console . log ( 'Before force close 2' ) ;
741759 await forceCloseForPool ( bob , alicePositionCount ) ;
742760 } catch ( error ) {
743761 if ( result === 'Ok' )
0 commit comments