@@ -358,7 +358,7 @@ export class ZilSwapV2 {
358358 const t0State = await this . fetchContractInit ( token0Contract )
359359 const t1State = await this . fetchContractInit ( token1Contract )
360360
361- const pair = `${ t0State . find ( ( i : Value ) => i . vname == 'symbol' ) . value } -${ t1State . find ( ( i : Value ) => i . vname == 'symbol' ) . value } `
361+ const pair = `${ t0State . find ( ( i : Value ) => i . vname === 'symbol' ) . value } -${ t1State . find ( ( i : Value ) => i . vname = == 'symbol' ) . value } `
362362 const name = `ZilSwap V2 ${ pair } LP Token`
363363 const symbol = `${ pair } .ZWAPv2LP`
364364
@@ -390,7 +390,7 @@ export class ZilSwapV2 {
390390 // Check logged in
391391 this . checkAppLoadedWithUser ( )
392392
393- let poolHash = this . getHash ( pool )
393+ const poolHash = this . getHash ( pool )
394394
395395 const contract : Contract = this . contract
396396 const args : any = [
@@ -1845,9 +1845,9 @@ export class ZilSwapV2 {
18451845 return tokenPath ;
18461846 }
18471847
1848- public findSwapPathIn ( swapPath : [ Pool , boolean ] [ ] , tokenInHash : string , tokenOutHash : string , tokenAmountIn : BigNumber , poolStepsLeft : number ) : { swapPath : [ Pool , boolean ] [ ] | null , expectedAmount : BigNumber } {
1848+ public findSwapPathIn ( path : [ Pool , boolean ] [ ] , tokenInHash : string , tokenOutHash : string , tokenAmountIn : BigNumber , poolStepsLeft : number ) : { swapPath : [ Pool , boolean ] [ ] | null , expectedAmount : BigNumber } {
18491849 const { pools } = this . getAppState ( ) ;
1850- const poolsPath = swapPath . map ( s => s [ 0 ] ) ;
1850+ const poolsPath = path . map ( s => s [ 0 ] ) ;
18511851
18521852 const optionPools = Object . values ( pools ) . filter ( ( pool ) => {
18531853 if ( poolsPath . includes ( pool ) ) return false ;
@@ -1857,7 +1857,7 @@ export class ZilSwapV2 {
18571857 let bestPath : [ Pool , boolean ] [ ] | null = null ;
18581858 for ( const pool of optionPools ) {
18591859 const isSameOrder = pool . contractState . token0 === tokenInHash ;
1860- const newPath = swapPath . concat ( [ [ pool , isSameOrder ] ] ) ;
1860+ const newPath = path . concat ( [ [ pool , isSameOrder ] ] ) ;
18611861 const [ poolTokenIn , poolTokenOut ] = isSameOrder ? [ pool . contractState . token0 , pool . contractState . token1 ] : [ pool . contractState . token1 , pool . contractState . token0 ] ;
18621862 const foundEndPool = poolTokenOut === tokenOutHash ;
18631863
@@ -1886,9 +1886,9 @@ export class ZilSwapV2 {
18861886 return { swapPath : bestPath , expectedAmount : bestAmount } ;
18871887 }
18881888
1889- public findSwapPathOut ( swapPath : [ Pool , boolean ] [ ] , tokenInHash : string , tokenOutHash : string , tokenAmountOut : BigNumber , poolStepsLeft : number ) : { swapPath : [ Pool , boolean ] [ ] | null , expectedAmount : BigNumber } {
1889+ public findSwapPathOut ( path : [ Pool , boolean ] [ ] , tokenInHash : string , tokenOutHash : string , tokenAmountOut : BigNumber , poolStepsLeft : number ) : { swapPath : [ Pool , boolean ] [ ] | null , expectedAmount : BigNumber } {
18901890 const { pools } = this . getAppState ( ) ;
1891- const poolsPath = swapPath . map ( s => s [ 0 ] ) ;
1891+ const poolsPath = path . map ( s => s [ 0 ] ) ;
18921892
18931893 const optionPools = Object . values ( pools ) . filter ( ( pool ) => {
18941894 if ( poolsPath . includes ( pool ) ) return false ;
@@ -1898,7 +1898,7 @@ export class ZilSwapV2 {
18981898 let bestPath : [ Pool , boolean ] [ ] | null = null ;
18991899 for ( const pool of optionPools ) {
19001900 const isSameOrder = pool . contractState . token1 === tokenOutHash ;
1901- const newPath : [ Pool , boolean ] [ ] = [ [ pool , isSameOrder ] , ...swapPath ] ;
1901+ const newPath : [ Pool , boolean ] [ ] = [ [ pool , isSameOrder ] , ...path ] ;
19021902 const [ poolTokenIn , poolTokenOut ] = isSameOrder ? [ pool . contractState . token0 , pool . contractState . token1 ] : [ pool . contractState . token1 , pool . contractState . token0 ] ;
19031903 const foundStartPool = poolTokenIn !== tokenInHash ;
19041904
@@ -1980,8 +1980,8 @@ export class ZilSwapV2 {
19801980 }
19811981
19821982 /**
1983- * Gets the contract with the given address that can be called by the default account.
1984- */
1983+ * Gets the contract with the given address that can be called by the default account.
1984+ */
19851985 public getContract ( address : string ) : Contract {
19861986 return ( this . walletProvider || this . zilliqa ) . contracts . at ( address )
19871987 }
@@ -2282,7 +2282,7 @@ export class ZilSwapV2 {
22822282 // get_amount_in
22832283 let numerator = new BigNumber ( reserveIn ) . multipliedBy ( amountOut )
22842284 let denominator = new BigNumber ( reserveOut ) . minus ( amountOut )
2285- let amountIn = numerator . dividedToIntegerBy ( denominator ) . plus ( 1 )
2285+ const amountIn = numerator . dividedToIntegerBy ( denominator ) . plus ( 1 )
22862286 numerator = amountIn . multipliedBy ( PRECISION )
22872287 denominator = new BigNumber ( PRECISION ) . minus ( feeInPrecision )
22882288 return numerator . plus ( denominator . minus ( 1 ) ) . dividedToIntegerBy ( denominator )
@@ -2457,7 +2457,7 @@ export class ZilSwapV2 {
24572457
24582458 // Update whole app state when routerState changes
24592459 if ( byStr20Address === this . contractHash ) {
2460- for ( const event of item . event_logs ) {
2460+ for ( const _ of item . event_logs ) {
24612461 this . updateAppState ( )
24622462 }
24632463 }
0 commit comments