From 4c2105a8c069b76b5b1fbb56319eebed27d781ce Mon Sep 17 00:00:00 2001 From: Alex Coseru Date: Mon, 16 Nov 2020 21:07:39 +0200 Subject: [PATCH] Bug/fullfill promises (#456) * fullfill promises * promises * fix maxprice * fix logging --- src/balancer/OceanPool.ts | 6 +++--- src/balancer/Pool.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index 71431b0b..022d4eb3 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -574,7 +574,7 @@ export class OceanPool extends Pool { this.logger.error('ERROR: OCEAN approve failed') return null } - const tx = await this.swapExactAmountOut( + const tx = await super.swapExactAmountOut( account, poolAddress, this.oceanAddress, @@ -631,7 +631,7 @@ export class OceanPool extends Pool { this.logger.error('ERROR: OCEAN approve failed') return null } - const tx = this.swapExactAmountIn( + const tx = await super.swapExactAmountIn( account, poolAddress, this.oceanAddress, @@ -687,7 +687,7 @@ export class OceanPool extends Pool { this.logger.error('ERROR: DT approve failed') return null } - const tx = this.swapExactAmountIn( + const tx = await super.swapExactAmountIn( account, poolAddress, dtAddress, diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index d97b8cd0..a9988417 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -6,9 +6,8 @@ import BigNumber from 'bignumber.js' import jsonpoolABI from '@oceanprotocol/contracts/artifacts/BPool.json' import { PoolFactory } from './PoolFactory' -const MaxUint256: BigNumber = new BigNumber( - '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' -) +const MaxUint256 = + '115792089237316195423570985008687907853269984665640564039457584007913129639934' /** * Provides an interface to Balancer BPool & BFactory */ @@ -548,6 +547,8 @@ export class Pool extends PoolFactory { ) .estimateGas((err, estGas) => (err ? gasLimitDefault : estGas)) } catch (e) { + this.logger.log('Error estimate gas swapExactAmountIn') + this.logger.log(e) estGas = gasLimitDefault } try { @@ -608,6 +609,8 @@ export class Pool extends PoolFactory { .estimateGas((err, estGas) => (err ? gasLimitDefault : estGas)) } catch (e) { estGas = gasLimitDefault + this.logger.log('Error estimate gas swapExactAmountIn') + this.logger.log(e) } try { result = await pool.methods