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

Bug/fullfill promises (#456)

* fullfill promises

* promises

* fix maxprice

* fix logging
This commit is contained in:
Alex Coseru 2020-11-16 21:07:39 +02:00 committed by GitHub
parent 8f9ef02b94
commit 4c2105a8c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -574,7 +574,7 @@ export class OceanPool extends Pool {
this.logger.error('ERROR: OCEAN approve failed') this.logger.error('ERROR: OCEAN approve failed')
return null return null
} }
const tx = await this.swapExactAmountOut( const tx = await super.swapExactAmountOut(
account, account,
poolAddress, poolAddress,
this.oceanAddress, this.oceanAddress,
@ -631,7 +631,7 @@ export class OceanPool extends Pool {
this.logger.error('ERROR: OCEAN approve failed') this.logger.error('ERROR: OCEAN approve failed')
return null return null
} }
const tx = this.swapExactAmountIn( const tx = await super.swapExactAmountIn(
account, account,
poolAddress, poolAddress,
this.oceanAddress, this.oceanAddress,
@ -687,7 +687,7 @@ export class OceanPool extends Pool {
this.logger.error('ERROR: DT approve failed') this.logger.error('ERROR: DT approve failed')
return null return null
} }
const tx = this.swapExactAmountIn( const tx = await super.swapExactAmountIn(
account, account,
poolAddress, poolAddress,
dtAddress, dtAddress,

View File

@ -6,9 +6,8 @@ import BigNumber from 'bignumber.js'
import jsonpoolABI from '@oceanprotocol/contracts/artifacts/BPool.json' import jsonpoolABI from '@oceanprotocol/contracts/artifacts/BPool.json'
import { PoolFactory } from './PoolFactory' import { PoolFactory } from './PoolFactory'
const MaxUint256: BigNumber = new BigNumber( const MaxUint256 =
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' '115792089237316195423570985008687907853269984665640564039457584007913129639934'
)
/** /**
* Provides an interface to Balancer BPool & BFactory * Provides an interface to Balancer BPool & BFactory
*/ */
@ -548,6 +547,8 @@ export class Pool extends PoolFactory {
) )
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas)) .estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
} catch (e) { } catch (e) {
this.logger.log('Error estimate gas swapExactAmountIn')
this.logger.log(e)
estGas = gasLimitDefault estGas = gasLimitDefault
} }
try { try {
@ -608,6 +609,8 @@ export class Pool extends PoolFactory {
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas)) .estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
} catch (e) { } catch (e) {
estGas = gasLimitDefault estGas = gasLimitDefault
this.logger.log('Error estimate gas swapExactAmountIn')
this.logger.log(e)
} }
try { try {
result = await pool.methods result = await pool.methods