1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

fix remove liquidity

This commit is contained in:
Matthias Kretschmann 2020-10-28 11:59:48 +01:00
parent cf4ae7676d
commit db66a6ce9e
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -815,11 +815,14 @@ export class Pool extends PoolFactory {
tokenAmountOut: string,
maxPoolAmountIn: string
): Promise<TransactionReceipt> {
const gasLimitDefault = this.GASLIMIT_DEFAULT
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
from: account
})
let result = null
let estGas
try {
estGas = await pool.methods
.exitswapExternAmountOut(
@ -827,16 +830,11 @@ export class Pool extends PoolFactory {
this.web3.utils.toWei(tokenAmountOut),
this.web3.utils.toWei(maxPoolAmountIn)
)
.estimateGas(function (err, estGas) {
if (err) {
// console.error('ERROR: OnChainMetadataCacheEstimateGas: ' + err)
return this.GASLIMIT_DEFAULT
}
return estGas
})
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
} catch (e) {
estGas = this.GASLIMIT_DEFAULT
estGas = gasLimitDefault
}
try {
result = await pool.methods
.exitswapExternAmountOut(