From caf83190b69a8582478312a8c3fc5e54135f7f49 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 12 May 2022 14:51:52 +0300 Subject: [PATCH 1/5] Fixing fixedRateContract undefined --- src/pools/fixedRate/FixedRateExchange.ts | 136 +++++++++++++---------- 1 file changed, 77 insertions(+), 59 deletions(-) diff --git a/src/pools/fixedRate/FixedRateExchange.ts b/src/pools/fixedRate/FixedRateExchange.ts index e1bdcf56..c2847d2f 100644 --- a/src/pools/fixedRate/FixedRateExchange.ts +++ b/src/pools/fixedRate/FixedRateExchange.ts @@ -60,9 +60,8 @@ export class FixedRateExchange { public oceanAddress: string = null public fixedRateAddress: string public fixedRateExchangeAbi: AbiItem | AbiItem[] - public fixedRateContract: Contract public web3: Web3 - public contract: Contract = null + public fixedRateContract: Contract = null public config: Config public ssAbi: AbiItem | AbiItem[] @@ -86,7 +85,7 @@ export class FixedRateExchange { fixedRateExchangeAbi || (defaultFixedRateExchangeAbi.abi as AbiItem[]) this.oceanAddress = oceanAddress this.fixedRateAddress = fixedRateAddress - this.contract = setContractDefaults( + this.fixedRateContract = setContractDefaults( new this.web3.eth.Contract(this.fixedRateExchangeAbi, this.fixedRateAddress), this.config ) @@ -115,7 +114,7 @@ export class FixedRateExchange { * @return {Promise} exchangeId */ public async generateExchangeId(baseToken: string, datatoken: string): Promise { - const exchangeId = await this.contract.methods + const exchangeId = await this.fixedRateContract.methods .generateExchangeId(baseToken, datatoken) .call() return exchangeId @@ -199,7 +198,7 @@ export class FixedRateExchange { consumeMarketFeeFormatted ) try { - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .buyDT( exchangeId, dtAmountFormatted, @@ -296,7 +295,7 @@ export class FixedRateExchange { consumeMarketFeeFormatted ) try { - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .sellDT( exchangeId, dtAmountFormatted, @@ -323,7 +322,9 @@ export class FixedRateExchange { * @return {Promise} no of available exchanges */ public async getNumberOfExchanges(): Promise { - const numExchanges = await this.contract.methods.getNumberOfExchanges().call() + const numExchanges = await this.fixedRateContract.methods + .getNumberOfExchanges() + .call() return numExchanges } @@ -342,13 +343,16 @@ export class FixedRateExchange { contractInstance?: Contract ): Promise { const fixedRate = contractInstance || this.fixedRateContract + console.log('### fixedRate', fixedRate) const gasLimitDefault = this.GASLIMIT_DEFAULT let estGas try { estGas = await fixedRate.methods .setRate(exchangeId, await this.web3.utils.toWei(newRate)) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) + console.log('estGas', estGas) } catch (e) { + console.log('### ERROR: ', e) estGas = gasLimitDefault } return estGas @@ -367,7 +371,7 @@ export class FixedRateExchange { newRate: string ): Promise { const estGas = await this.estSetRate(address, exchangeId, newRate) - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .setRate(exchangeId, this.web3.utils.toWei(newRate)) .send({ from: address, @@ -417,7 +421,7 @@ export class FixedRateExchange { newAllowedSwapper: string ): Promise { const estGas = await this.estSetAllowedSwapper(address, exchangeId, newAllowedSwapper) - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .setAllowedSwapper(exchangeId, newAllowedSwapper) .send({ from: address, @@ -467,11 +471,13 @@ export class FixedRateExchange { if (exchange.active === true) return null const estGas = await this.estActivate(address, exchangeId) - const trxReceipt = await this.contract.methods.toggleExchangeState(exchangeId).send({ - from: address, - gas: estGas + 1, - gasPrice: await getFairGasPrice(this.web3, this.config) - }) + const trxReceipt = await this.fixedRateContract.methods + .toggleExchangeState(exchangeId) + .send({ + from: address, + gas: estGas + 1, + gasPrice: await getFairGasPrice(this.web3, this.config) + }) return trxReceipt } @@ -516,11 +522,13 @@ export class FixedRateExchange { const estGas = await this.estDeactivate(address, exchangeId) - const trxReceipt = await this.contract.methods.toggleExchangeState(exchangeId).send({ - from: address, - gas: estGas + 1, - gasPrice: await getFairGasPrice(this.web3, this.config) - }) + const trxReceipt = await this.fixedRateContract.methods + .toggleExchangeState(exchangeId) + .send({ + from: address, + gas: estGas + 1, + gasPrice: await getFairGasPrice(this.web3, this.config) + }) return trxReceipt } @@ -531,7 +539,7 @@ export class FixedRateExchange { * @return {Promise} Rate (converted from wei) */ public async getRate(exchangeId: string): Promise { - const weiRate = await this.contract.methods.getRate(exchangeId).call() + const weiRate = await this.fixedRateContract.methods.getRate(exchangeId).call() const rate = await this.web3.utils.fromWei(weiRate) return rate } @@ -542,7 +550,7 @@ export class FixedRateExchange { * @return {Promise} dt supply formatted */ public async getDTSupply(exchangeId: string): Promise { - const dtSupply = await this.contract.methods.getDTSupply(exchangeId).call() + const dtSupply = await this.fixedRateContract.methods.getDTSupply(exchangeId).call() const exchange = await this.getExchange(exchangeId) return await this.unitsToAmount(exchange.datatoken, dtSupply, +exchange.dtDecimals) } @@ -553,7 +561,7 @@ export class FixedRateExchange { * @return {Promise} dt supply formatted */ public async getBTSupply(exchangeId: string): Promise { - const btSupply = await this.contract.methods.getBTSupply(exchangeId).call() + const btSupply = await this.fixedRateContract.methods.getBTSupply(exchangeId).call() const exchange = await this.getExchange(exchangeId) return await this.unitsToAmount(exchange.baseToken, btSupply, +exchange.btDecimals) } @@ -564,7 +572,7 @@ export class FixedRateExchange { * @return {Promise} address of allowedSwapper */ public async getAllowedSwapper(exchangeId: string): Promise { - return await this.contract.methods.getAllowedSwapper(exchangeId).call() + return await this.fixedRateContract.methods.getAllowedSwapper(exchangeId).call() } /** @@ -580,7 +588,7 @@ export class FixedRateExchange { consumeMarketFee: string = '0' ): Promise { const fixedRateExchange = await this.getExchange(exchangeId) - const result = await this.contract.methods + const result = await this.fixedRateContract.methods .calcBaseInGivenOutDT( exchangeId, await this.amountToUnits( @@ -630,7 +638,7 @@ export class FixedRateExchange { consumeMarketFee: string = '0' ): Promise { const exchange = await this.getExchange(exchangeId) - const result = await this.contract.methods + const result = await this.fixedRateContract.methods .calcBaseOutGivenInDT( exchangeId, await this.amountToUnits( @@ -651,7 +659,7 @@ export class FixedRateExchange { * @return {Promise} Exchange details */ public async getExchange(exchangeId: string): Promise { - const result: FixedPriceExchange = await this.contract.methods + const result: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() result.dtDecimals = result.dtDecimals.toString() @@ -687,7 +695,9 @@ export class FixedRateExchange { * @return {Promise} Exchange details */ public async getFeesInfo(exchangeId: string): Promise { - const result: FeesInfo = await this.contract.methods.getFeesInfo(exchangeId).call() + const result: FeesInfo = await this.fixedRateContract.methods + .getFeesInfo(exchangeId) + .call() result.opcFee = this.web3.utils.fromWei(result.opcFee.toString()) result.marketFee = this.web3.utils.fromWei(result.marketFee.toString()) @@ -713,7 +723,7 @@ export class FixedRateExchange { * @return {Promise} Exchanges list */ public async getExchanges(): Promise { - return await this.contract.methods.getExchanges().call() + return await this.fixedRateContract.methods.getExchanges().call() } /** @@ -722,7 +732,7 @@ export class FixedRateExchange { * @return {Promise} Result */ public async isActive(exchangeId: string): Promise { - const result = await this.contract.methods.isActive(exchangeId).call() + const result = await this.fixedRateContract.methods.isActive(exchangeId).call() return result } @@ -766,7 +776,7 @@ export class FixedRateExchange { if (exchange.withMint === true) return null const estGas = await this.estActivateMint(address, exchangeId) - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .toggleMintState(exchangeId, true) .send({ from: address, @@ -817,7 +827,7 @@ export class FixedRateExchange { const estGas = await this.estDeactivate(address, exchangeId) - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .toggleMintState(exchangeId, false) .send({ from: address, @@ -845,7 +855,7 @@ export class FixedRateExchange { const fixedRate = contractInstance || this.fixedRateContract const gasLimitDefault = this.GASLIMIT_DEFAULT let estGas - const fixedrate: FixedPriceExchange = await this.contract.methods + const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() const amountWei = await this.amountToUnits( @@ -879,7 +889,7 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectBT(address, exchangeId, amount) - const fixedrate: FixedPriceExchange = await this.contract.methods + const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() const amountWei = await this.amountToUnits( @@ -887,11 +897,13 @@ export class FixedRateExchange { amount, +fixedrate.btDecimals ) - const trxReceipt = await this.contract.methods.collectBT(exchangeId, amountWei).send({ - from: address, - gas: estGas + 1, - gasPrice: await getFairGasPrice(this.web3, this.config) - }) + const trxReceipt = await this.fixedRateContract.methods + .collectBT(exchangeId, amountWei) + .send({ + from: address, + gas: estGas + 1, + gasPrice: await getFairGasPrice(this.web3, this.config) + }) return trxReceipt } @@ -912,7 +924,7 @@ export class FixedRateExchange { const fixedRate = contractInstance || this.fixedRateContract const gasLimitDefault = this.GASLIMIT_DEFAULT let estGas - const fixedrate: FixedPriceExchange = await this.contract.methods + const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() const amountWei = await this.amountToUnits( @@ -946,7 +958,7 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectDT(address, exchangeId, amount) - const fixedrate: FixedPriceExchange = await this.contract.methods + const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() const amountWei = await this.amountToUnits( @@ -954,11 +966,13 @@ export class FixedRateExchange { amount, +fixedrate.dtDecimals ) - const trxReceipt = await this.contract.methods.collectDT(exchangeId, amountWei).send({ - from: address, - gas: estGas + 1, - gasPrice: await getFairGasPrice(this.web3, this.config) - }) + const trxReceipt = await this.fixedRateContract.methods + .collectDT(exchangeId, amountWei) + .send({ + from: address, + gas: estGas + 1, + gasPrice: await getFairGasPrice(this.web3, this.config) + }) return trxReceipt } @@ -1001,11 +1015,13 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectMarketFee(address, exchangeId) - const trxReceipt = await this.contract.methods.collectMarketFee(exchangeId).send({ - from: address, - gas: estGas + 1, - gasPrice: await getFairGasPrice(this.web3, this.config) - }) + const trxReceipt = await this.fixedRateContract.methods + .collectMarketFee(exchangeId) + .send({ + from: address, + gas: estGas + 1, + gasPrice: await getFairGasPrice(this.web3, this.config) + }) return trxReceipt } @@ -1048,11 +1064,13 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectOceanFee(address, exchangeId) - const trxReceipt = await this.contract.methods.collectOceanFee(exchangeId).send({ - from: address, - gas: estGas + 1, - gasPrice: await getFairGasPrice(this.web3, this.config) - }) + const trxReceipt = await this.fixedRateContract.methods + .collectOceanFee(exchangeId) + .send({ + from: address, + gas: estGas + 1, + gasPrice: await getFairGasPrice(this.web3, this.config) + }) return trxReceipt } @@ -1063,7 +1081,7 @@ export class FixedRateExchange { async getOPCCollector(): Promise { let result = null try { - result = await this.contract.methods.opcCollector().call() + result = await this.fixedRateContract.methods.opcCollector().call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get OPC Collector address: ${e.message}`) } @@ -1077,7 +1095,7 @@ export class FixedRateExchange { async getRouter(): Promise { let result = null try { - result = await this.contract.methods.router().call() + result = await this.fixedRateContract.methods.router().call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get Router address: ${e.message}`) } @@ -1143,7 +1161,7 @@ export class FixedRateExchange { exchangeId, this.web3.utils.toWei(newMarketFee) ) - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .updateMarketFee(exchangeId, this.web3.utils.toWei(newMarketFee)) .send({ from: address, @@ -1197,7 +1215,7 @@ export class FixedRateExchange { exchangeId, newMarketFeeCollector ) - const trxReceipt = await this.contract.methods + const trxReceipt = await this.fixedRateContract.methods .updateMarketFeeCollector(exchangeId, newMarketFeeCollector) .send({ from: address, From b9e89bb335bfac54bef87fe9cabee97b08a23c7c Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 12 May 2022 17:34:45 +0300 Subject: [PATCH 2/5] Fixing estSetAllowedSwapper --- src/pools/fixedRate/FixedRateExchange.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pools/fixedRate/FixedRateExchange.ts b/src/pools/fixedRate/FixedRateExchange.ts index c2847d2f..31d06994 100644 --- a/src/pools/fixedRate/FixedRateExchange.ts +++ b/src/pools/fixedRate/FixedRateExchange.ts @@ -197,6 +197,7 @@ export class FixedRateExchange { consumeMarketAddress, consumeMarketFeeFormatted ) + console.log('estGas', estGas) try { const trxReceipt = await this.fixedRateContract.methods .buyDT( @@ -294,6 +295,7 @@ export class FixedRateExchange { consumeMarketAddress, consumeMarketFeeFormatted ) + console.log('estGas', estGas) try { const trxReceipt = await this.fixedRateContract.methods .sellDT( @@ -371,6 +373,7 @@ export class FixedRateExchange { newRate: string ): Promise { const estGas = await this.estSetRate(address, exchangeId, newRate) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .setRate(exchangeId, this.web3.utils.toWei(newRate)) .send({ @@ -400,7 +403,7 @@ export class FixedRateExchange { let estGas try { estGas = await fixedRate.methods - .setRate(exchangeId, newAllowedSwapper) + .setAllowedSwapper(exchangeId, newAllowedSwapper) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) } catch (e) { estGas = gasLimitDefault @@ -421,6 +424,7 @@ export class FixedRateExchange { newAllowedSwapper: string ): Promise { const estGas = await this.estSetAllowedSwapper(address, exchangeId, newAllowedSwapper) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .setAllowedSwapper(exchangeId, newAllowedSwapper) .send({ @@ -471,6 +475,7 @@ export class FixedRateExchange { if (exchange.active === true) return null const estGas = await this.estActivate(address, exchangeId) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleExchangeState(exchangeId) .send({ @@ -521,6 +526,7 @@ export class FixedRateExchange { if (exchange.active === false) return null const estGas = await this.estDeactivate(address, exchangeId) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleExchangeState(exchangeId) @@ -776,6 +782,7 @@ export class FixedRateExchange { if (exchange.withMint === true) return null const estGas = await this.estActivateMint(address, exchangeId) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleMintState(exchangeId, true) .send({ @@ -805,7 +812,9 @@ export class FixedRateExchange { estGas = await fixedRate.methods .toggleMintState(exchangeId) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) + console.log('### estGas', estGas) } catch (e) { + console.log('e', e) estGas = gasLimitDefault } return estGas @@ -826,6 +835,7 @@ export class FixedRateExchange { if (exchange.withMint === false) return null const estGas = await this.estDeactivate(address, exchangeId) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleMintState(exchangeId, false) @@ -889,6 +899,7 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectBT(address, exchangeId, amount) + console.log('estGas', estGas) const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() @@ -958,6 +969,7 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectDT(address, exchangeId, amount) + console.log('estGas', estGas) const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() @@ -1015,6 +1027,7 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectMarketFee(address, exchangeId) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .collectMarketFee(exchangeId) .send({ @@ -1064,6 +1077,7 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectOceanFee(address, exchangeId) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .collectOceanFee(exchangeId) .send({ @@ -1161,6 +1175,7 @@ export class FixedRateExchange { exchangeId, this.web3.utils.toWei(newMarketFee) ) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .updateMarketFee(exchangeId, this.web3.utils.toWei(newMarketFee)) .send({ @@ -1215,6 +1230,7 @@ export class FixedRateExchange { exchangeId, newMarketFeeCollector ) + console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .updateMarketFeeCollector(exchangeId, newMarketFeeCollector) .send({ From 1de19f8e2b2c39aa0ef9fb003fdfa32d4265e88b Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 12 May 2022 17:39:08 +0300 Subject: [PATCH 3/5] Fixing deactivateMint estimate gas cost --- src/pools/fixedRate/FixedRateExchange.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pools/fixedRate/FixedRateExchange.ts b/src/pools/fixedRate/FixedRateExchange.ts index 31d06994..d9774b36 100644 --- a/src/pools/fixedRate/FixedRateExchange.ts +++ b/src/pools/fixedRate/FixedRateExchange.ts @@ -810,7 +810,7 @@ export class FixedRateExchange { let estGas try { estGas = await fixedRate.methods - .toggleMintState(exchangeId) + .toggleMintState(exchangeId, false) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) console.log('### estGas', estGas) } catch (e) { @@ -834,7 +834,7 @@ export class FixedRateExchange { if (!exchange) return null if (exchange.withMint === false) return null - const estGas = await this.estDeactivate(address, exchangeId) + const estGas = await this.estDeactivateMint(address, exchangeId) console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods From c9b297a85833b965e14cf534118dce10f9263a0d Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 12 May 2022 18:10:02 +0300 Subject: [PATCH 4/5] Removing console.logs --- src/pools/fixedRate/FixedRateExchange.ts | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/pools/fixedRate/FixedRateExchange.ts b/src/pools/fixedRate/FixedRateExchange.ts index d9774b36..22dfff87 100644 --- a/src/pools/fixedRate/FixedRateExchange.ts +++ b/src/pools/fixedRate/FixedRateExchange.ts @@ -197,7 +197,6 @@ export class FixedRateExchange { consumeMarketAddress, consumeMarketFeeFormatted ) - console.log('estGas', estGas) try { const trxReceipt = await this.fixedRateContract.methods .buyDT( @@ -295,7 +294,6 @@ export class FixedRateExchange { consumeMarketAddress, consumeMarketFeeFormatted ) - console.log('estGas', estGas) try { const trxReceipt = await this.fixedRateContract.methods .sellDT( @@ -345,16 +343,13 @@ export class FixedRateExchange { contractInstance?: Contract ): Promise { const fixedRate = contractInstance || this.fixedRateContract - console.log('### fixedRate', fixedRate) const gasLimitDefault = this.GASLIMIT_DEFAULT let estGas try { estGas = await fixedRate.methods .setRate(exchangeId, await this.web3.utils.toWei(newRate)) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) - console.log('estGas', estGas) } catch (e) { - console.log('### ERROR: ', e) estGas = gasLimitDefault } return estGas @@ -373,7 +368,6 @@ export class FixedRateExchange { newRate: string ): Promise { const estGas = await this.estSetRate(address, exchangeId, newRate) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .setRate(exchangeId, this.web3.utils.toWei(newRate)) .send({ @@ -424,7 +418,6 @@ export class FixedRateExchange { newAllowedSwapper: string ): Promise { const estGas = await this.estSetAllowedSwapper(address, exchangeId, newAllowedSwapper) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .setAllowedSwapper(exchangeId, newAllowedSwapper) .send({ @@ -475,7 +468,6 @@ export class FixedRateExchange { if (exchange.active === true) return null const estGas = await this.estActivate(address, exchangeId) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleExchangeState(exchangeId) .send({ @@ -526,7 +518,6 @@ export class FixedRateExchange { if (exchange.active === false) return null const estGas = await this.estDeactivate(address, exchangeId) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleExchangeState(exchangeId) @@ -782,7 +773,6 @@ export class FixedRateExchange { if (exchange.withMint === true) return null const estGas = await this.estActivateMint(address, exchangeId) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleMintState(exchangeId, true) .send({ @@ -812,9 +802,7 @@ export class FixedRateExchange { estGas = await fixedRate.methods .toggleMintState(exchangeId, false) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) - console.log('### estGas', estGas) } catch (e) { - console.log('e', e) estGas = gasLimitDefault } return estGas @@ -835,7 +823,6 @@ export class FixedRateExchange { if (exchange.withMint === false) return null const estGas = await this.estDeactivateMint(address, exchangeId) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .toggleMintState(exchangeId, false) @@ -899,7 +886,6 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectBT(address, exchangeId, amount) - console.log('estGas', estGas) const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() @@ -969,7 +955,6 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectDT(address, exchangeId, amount) - console.log('estGas', estGas) const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods .getExchange(exchangeId) .call() @@ -1027,7 +1012,6 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectMarketFee(address, exchangeId) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .collectMarketFee(exchangeId) .send({ @@ -1077,7 +1061,6 @@ export class FixedRateExchange { if (!exchange) return null const estGas = await this.estCollectOceanFee(address, exchangeId) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .collectOceanFee(exchangeId) .send({ @@ -1175,7 +1158,6 @@ export class FixedRateExchange { exchangeId, this.web3.utils.toWei(newMarketFee) ) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .updateMarketFee(exchangeId, this.web3.utils.toWei(newMarketFee)) .send({ @@ -1230,7 +1212,6 @@ export class FixedRateExchange { exchangeId, newMarketFeeCollector ) - console.log('estGas', estGas) const trxReceipt = await this.fixedRateContract.methods .updateMarketFeeCollector(exchangeId, newMarketFeeCollector) .send({ From 01e646c10fc3672e0f29f166d3ed5addea68c8cf Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Fri, 20 May 2022 14:07:50 +0300 Subject: [PATCH 5/5] Fixing bug in deactivateMint gas estimation --- src/pools/fixedRate/FixedRateExchange.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pools/fixedRate/FixedRateExchange.ts b/src/pools/fixedRate/FixedRateExchange.ts index 9d98c479..ca3e5bd9 100644 --- a/src/pools/fixedRate/FixedRateExchange.ts +++ b/src/pools/fixedRate/FixedRateExchange.ts @@ -803,7 +803,7 @@ export class FixedRateExchange { const estGas = await estimateGas( address, - this.fixedRateContract.methods.methods.toggleMintState, + this.fixedRateContract.methods.toggleMintState, exchangeId, false )