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

Fixing estSetAllowedSwapper

This commit is contained in:
Jamie Hewitt 2022-05-12 17:34:45 +03:00
parent caf83190b6
commit b9e89bb335

View File

@ -197,6 +197,7 @@ export class FixedRateExchange {
consumeMarketAddress, consumeMarketAddress,
consumeMarketFeeFormatted consumeMarketFeeFormatted
) )
console.log('estGas', estGas)
try { try {
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.buyDT( .buyDT(
@ -294,6 +295,7 @@ export class FixedRateExchange {
consumeMarketAddress, consumeMarketAddress,
consumeMarketFeeFormatted consumeMarketFeeFormatted
) )
console.log('estGas', estGas)
try { try {
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.sellDT( .sellDT(
@ -371,6 +373,7 @@ export class FixedRateExchange {
newRate: string newRate: string
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const estGas = await this.estSetRate(address, exchangeId, newRate) const estGas = await this.estSetRate(address, exchangeId, newRate)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.setRate(exchangeId, this.web3.utils.toWei(newRate)) .setRate(exchangeId, this.web3.utils.toWei(newRate))
.send({ .send({
@ -400,7 +403,7 @@ export class FixedRateExchange {
let estGas let estGas
try { try {
estGas = await fixedRate.methods estGas = await fixedRate.methods
.setRate(exchangeId, newAllowedSwapper) .setAllowedSwapper(exchangeId, newAllowedSwapper)
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
} catch (e) { } catch (e) {
estGas = gasLimitDefault estGas = gasLimitDefault
@ -421,6 +424,7 @@ export class FixedRateExchange {
newAllowedSwapper: string newAllowedSwapper: string
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const estGas = await this.estSetAllowedSwapper(address, exchangeId, newAllowedSwapper) const estGas = await this.estSetAllowedSwapper(address, exchangeId, newAllowedSwapper)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.setAllowedSwapper(exchangeId, newAllowedSwapper) .setAllowedSwapper(exchangeId, newAllowedSwapper)
.send({ .send({
@ -471,6 +475,7 @@ export class FixedRateExchange {
if (exchange.active === true) return null if (exchange.active === true) return null
const estGas = await this.estActivate(address, exchangeId) const estGas = await this.estActivate(address, exchangeId)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.toggleExchangeState(exchangeId) .toggleExchangeState(exchangeId)
.send({ .send({
@ -521,6 +526,7 @@ export class FixedRateExchange {
if (exchange.active === false) return null if (exchange.active === false) return null
const estGas = await this.estDeactivate(address, exchangeId) const estGas = await this.estDeactivate(address, exchangeId)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.toggleExchangeState(exchangeId) .toggleExchangeState(exchangeId)
@ -776,6 +782,7 @@ export class FixedRateExchange {
if (exchange.withMint === true) return null if (exchange.withMint === true) return null
const estGas = await this.estActivateMint(address, exchangeId) const estGas = await this.estActivateMint(address, exchangeId)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.toggleMintState(exchangeId, true) .toggleMintState(exchangeId, true)
.send({ .send({
@ -805,7 +812,9 @@ export class FixedRateExchange {
estGas = await fixedRate.methods estGas = await fixedRate.methods
.toggleMintState(exchangeId) .toggleMintState(exchangeId)
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
console.log('### estGas', estGas)
} catch (e) { } catch (e) {
console.log('e', e)
estGas = gasLimitDefault estGas = gasLimitDefault
} }
return estGas return estGas
@ -826,6 +835,7 @@ export class FixedRateExchange {
if (exchange.withMint === false) return null if (exchange.withMint === false) return null
const estGas = await this.estDeactivate(address, exchangeId) const estGas = await this.estDeactivate(address, exchangeId)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.toggleMintState(exchangeId, false) .toggleMintState(exchangeId, false)
@ -889,6 +899,7 @@ export class FixedRateExchange {
if (!exchange) return null if (!exchange) return null
const estGas = await this.estCollectBT(address, exchangeId, amount) const estGas = await this.estCollectBT(address, exchangeId, amount)
console.log('estGas', estGas)
const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods
.getExchange(exchangeId) .getExchange(exchangeId)
.call() .call()
@ -958,6 +969,7 @@ export class FixedRateExchange {
if (!exchange) return null if (!exchange) return null
const estGas = await this.estCollectDT(address, exchangeId, amount) const estGas = await this.estCollectDT(address, exchangeId, amount)
console.log('estGas', estGas)
const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods const fixedrate: FixedPriceExchange = await this.fixedRateContract.methods
.getExchange(exchangeId) .getExchange(exchangeId)
.call() .call()
@ -1015,6 +1027,7 @@ export class FixedRateExchange {
if (!exchange) return null if (!exchange) return null
const estGas = await this.estCollectMarketFee(address, exchangeId) const estGas = await this.estCollectMarketFee(address, exchangeId)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.collectMarketFee(exchangeId) .collectMarketFee(exchangeId)
.send({ .send({
@ -1064,6 +1077,7 @@ export class FixedRateExchange {
if (!exchange) return null if (!exchange) return null
const estGas = await this.estCollectOceanFee(address, exchangeId) const estGas = await this.estCollectOceanFee(address, exchangeId)
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.collectOceanFee(exchangeId) .collectOceanFee(exchangeId)
.send({ .send({
@ -1161,6 +1175,7 @@ export class FixedRateExchange {
exchangeId, exchangeId,
this.web3.utils.toWei(newMarketFee) this.web3.utils.toWei(newMarketFee)
) )
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.updateMarketFee(exchangeId, this.web3.utils.toWei(newMarketFee)) .updateMarketFee(exchangeId, this.web3.utils.toWei(newMarketFee))
.send({ .send({
@ -1215,6 +1230,7 @@ export class FixedRateExchange {
exchangeId, exchangeId,
newMarketFeeCollector newMarketFeeCollector
) )
console.log('estGas', estGas)
const trxReceipt = await this.fixedRateContract.methods const trxReceipt = await this.fixedRateContract.methods
.updateMarketFeeCollector(exchangeId, newMarketFeeCollector) .updateMarketFeeCollector(exchangeId, newMarketFeeCollector)
.send({ .send({