def calcOutGivenIn(self, pool_address: str, token_in_address: str, token_out_address: str, token_in_amount: float): pool = BPool(pool_address) out_amount = pool.calcOutGivenIn( pool.getBalance(token_in_address), pool.getDenormalizedWeight(token_in_address), pool.getBalance(token_out_address), pool.getDenormalizedWeight(token_out_address), to_base_18(token_in_amount), pool.getSwapFee()) return from_base_18(out_amount)
def calcOutGivenIn( self, pool_address: str, token_in_address: str, token_out_address: str, token_in_amount: int, ) -> int: pool = BPool(self.web3, pool_address) return pool.calcOutGivenIn( pool.getBalance(token_in_address), pool.getDenormalizedWeight(token_in_address), pool.getBalance(token_out_address), pool.getDenormalizedWeight(token_out_address), token_in_amount, pool.getSwapFee(), )