import { BigNumber , BigNumberish } from '@ethersproject/bignumber' ; import { WeiPerEther as ONE } from '@ethersproject/constants' ; import { BPTForTokensZeroPriceImpact as stableBPTForTokensZeroPriceImpact } from './stableHelpers' ; export function BPTForTokensZeroPriceImpact ( allBalances , decimals , amounts , virtualBptSupply , amp , fee , rates ) { const amountsAfterFee = amounts . map ( ( amountIn , i ) => { const amount = BigNumber . from ( amountIn ) ; const feeAmount = amount . mul ( fee ) . div ( ONE ) ; return amount . sub ( feeAmount ) ; } ) ; const transformedBalances = allBalances . map ( ( balance , i ) => { return BigNumber . from ( balance ) . mul ( rates [ i ] ) . div ( ONE ) ; } ) ; return stableBPTForTokensZeroPriceImpact ( transformedBalances , decimals , amountsAfterFee , virtualBptSupply , amp ) ; }