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

review fixes

This commit is contained in:
Bogdan Fazakas 2022-08-18 10:50:50 +03:00
parent a5e5d69241
commit 16a1f0b094
9 changed files with 88 additions and 94 deletions

View File

@ -73,7 +73,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.approve, dtContract.methods.approve,
spender, spender,
this.web3.utils.toWei(amount) this.web3.utils.toWei(amount)
@ -129,7 +129,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.createFixedRate, dtContract.methods.createFixedRate,
fixedRateParams.fixedRateAddress, fixedRateParams.fixedRateAddress,
[ [
@ -191,7 +191,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.createDispenser, dtContract.methods.createDispenser,
dispenserAddress, dispenserAddress,
dispenserParams.maxTokens, dispenserParams.maxTokens,
@ -237,7 +237,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.mint, dtContract.methods.mint,
toAddress || address, toAddress || address,
this.web3.utils.toWei(amount) this.web3.utils.toWei(amount)
@ -279,7 +279,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.addMinter, dtContract.methods.addMinter,
minter minter
) )
@ -319,7 +319,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.removeMinter, dtContract.methods.removeMinter,
minter minter
) )
@ -358,7 +358,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.addPaymentManager, dtContract.methods.addPaymentManager,
paymentManager paymentManager
) )
@ -397,7 +397,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.removePaymentManager, dtContract.methods.removePaymentManager,
paymentManager paymentManager
) )
@ -443,7 +443,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.setPaymentCollector, dtContract.methods.setPaymentCollector,
paymentCollector paymentCollector
) )
@ -507,7 +507,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.transfer, dtContract.methods.transfer,
toAddress, toAddress,
amount amount
@ -556,7 +556,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.startOrder, dtContract.methods.startOrder,
consumer, consumer,
serviceIndex, serviceIndex,
@ -596,7 +596,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.reuseOrder, dtContract.methods.reuseOrder,
orderTxId, orderTxId,
providerFees providerFees
@ -634,7 +634,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.buyFromFreAndOrder, dtContract.methods.buyFromFreAndOrder,
orderParams, orderParams,
freContractParams freContractParams
@ -670,7 +670,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.buyFromDispenserAndOrder, dtContract.methods.buyFromDispenserAndOrder,
orderParams, orderParams,
dispenserContract dispenserContract
@ -711,7 +711,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.setData, dtContract.methods.setData,
valueHex valueHex
) )
@ -746,7 +746,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.cleanPermissions dtContract.methods.cleanPermissions
) )
@ -856,7 +856,7 @@ export class Datatoken extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
dtContract.methods.setPublishingMarketFee, dtContract.methods.setPublishingMarketFee,
publishMarketFeeAddress, publishMarketFeeAddress,
publishMarketFeeToken, publishMarketFeeToken,

View File

@ -61,7 +61,7 @@ export class Dispenser extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.create, this.contract.methods.create,
dtAddress, dtAddress,
this.web3.utils.toWei(maxTokens), this.web3.utils.toWei(maxTokens),
@ -101,7 +101,7 @@ export class Dispenser extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.activate, this.contract.methods.activate,
dtAddress, dtAddress,
this.web3.utils.toWei(maxTokens), this.web3.utils.toWei(maxTokens),
@ -133,7 +133,7 @@ export class Dispenser extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.deactivate, this.contract.methods.deactivate,
dtAddress dtAddress
) )
@ -166,7 +166,7 @@ export class Dispenser extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.setAllowedSwapper, this.contract.methods.setAllowedSwapper,
dtAddress, dtAddress,
newAllowedSwapper newAllowedSwapper
@ -204,7 +204,7 @@ export class Dispenser extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.dispense, this.contract.methods.dispense,
dtAddress, dtAddress,
this.web3.utils.toWei(amount), this.web3.utils.toWei(amount),
@ -235,7 +235,7 @@ export class Dispenser extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.ownerWithdraw, this.contract.methods.ownerWithdraw,
dtAddress dtAddress
) )

View File

@ -70,7 +70,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.buyDT, this.contract.methods.buyDT,
exchangeId, exchangeId,
dtAmountFormatted, dtAmountFormatted,
@ -128,7 +128,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.sellDT, this.contract.methods.sellDT,
exchangeId, exchangeId,
dtAmountFormatted, dtAmountFormatted,
@ -175,7 +175,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.setRate, this.contract.methods.setRate,
exchangeId, exchangeId,
this.web3.utils.toWei(newRate) this.web3.utils.toWei(newRate)
@ -209,7 +209,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.setAllowedSwapper, this.contract.methods.setAllowedSwapper,
exchangeId, exchangeId,
newAllowedSwapper newAllowedSwapper
@ -242,7 +242,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.toggleExchangeState, this.contract.methods.toggleExchangeState,
exchangeId exchangeId
) )
@ -275,7 +275,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.toggleExchangeState, this.contract.methods.toggleExchangeState,
exchangeId exchangeId
) )
@ -510,7 +510,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.toggleMintState, this.contract.methods.toggleMintState,
exchangeId, exchangeId,
true true
@ -545,7 +545,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.toggleMintState, this.contract.methods.toggleMintState,
exchangeId, exchangeId,
false false
@ -590,7 +590,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.collectBT, this.contract.methods.collectBT,
exchangeId, exchangeId,
amountWei amountWei
@ -635,7 +635,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.collectDT, this.contract.methods.collectDT,
exchangeId, exchangeId,
amountWei amountWei
@ -668,7 +668,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.collectMarketFee, this.contract.methods.collectMarketFee,
exchangeId exchangeId
) )
@ -701,7 +701,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.collectOceanFee, this.contract.methods.collectOceanFee,
exchangeId exchangeId
) )
@ -762,7 +762,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.updateMarketFee, this.contract.methods.updateMarketFee,
exchangeId, exchangeId,
this.web3.utils.toWei(newMarketFee) this.web3.utils.toWei(newMarketFee)
@ -796,7 +796,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.updateMarketFeeCollector, this.contract.methods.updateMarketFeeCollector,
exchangeId, exchangeId,
newMarketFeeCollector newMarketFeeCollector

View File

@ -67,7 +67,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.createERC20, nftContract.methods.createERC20,
templateIndex, templateIndex,
[name, symbol], [name, symbol],
@ -109,7 +109,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.addManager, nftContract.methods.addManager,
manager manager
) )
@ -147,7 +147,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.removeManager, nftContract.methods.removeManager,
manager manager
) )
@ -186,7 +186,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.addToCreateERC20List, nftContract.methods.addToCreateERC20List,
datatokenDeployer datatokenDeployer
) )
@ -227,7 +227,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.removeFromCreateERC20List, nftContract.methods.removeFromCreateERC20List,
datatokenDeployer datatokenDeployer
) )
@ -265,7 +265,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.addToMetadataList, nftContract.methods.addToMetadataList,
metadataUpdater metadataUpdater
) )
@ -306,7 +306,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.removeFromMetadataList, nftContract.methods.removeFromMetadataList,
metadataUpdater metadataUpdater
) )
@ -343,7 +343,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.addTo725StoreList, nftContract.methods.addTo725StoreList,
storeUpdater storeUpdater
) )
@ -385,7 +385,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.removeFrom725StoreList, nftContract.methods.removeFrom725StoreList,
storeUpdater storeUpdater
) )
@ -423,7 +423,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.cleanPermissions nftContract.methods.cleanPermissions
) )
@ -467,7 +467,7 @@ export class Nft extends SmartContract {
nftOwner, nftOwner,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.transferFrom, nftContract.methods.transferFrom,
nftOwner, nftOwner,
nftReceiver, nftReceiver,
@ -514,7 +514,7 @@ export class Nft extends SmartContract {
nftOwner, nftOwner,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.safeTransferFrom, nftContract.methods.safeTransferFrom,
nftOwner, nftOwner,
nftReceiver, nftReceiver,
@ -570,7 +570,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.setMetaData, nftContract.methods.setMetaData,
metadataState, metadataState,
metadataDecryptorUrl, metadataDecryptorUrl,
@ -616,7 +616,7 @@ export class Nft extends SmartContract {
metadataUpdater, metadataUpdater,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.setMetaDataAndTokenURI, nftContract.methods.setMetaDataAndTokenURI,
sanitizedMetadataAndTokenURI sanitizedMetadataAndTokenURI
) )
@ -654,7 +654,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.setMetaDataState, nftContract.methods.setMetaDataState,
metadataState metadataState
) )
@ -687,7 +687,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.setTokenURI, nftContract.methods.setTokenURI,
'1', '1',
data data
@ -774,7 +774,7 @@ export class Nft extends SmartContract {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
nftContract.methods.setNewData, nftContract.methods.setNewData,
keyHash, keyHash,
valueHex valueHex

View File

@ -68,7 +68,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.deployERC721Contract, this.contract.methods.deployERC721Contract,
nftData.name, nftData.name,
nftData.symbol, nftData.symbol,
@ -194,7 +194,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.add721TokenTemplate, this.contract.methods.add721TokenTemplate,
templateAddress templateAddress
) )
@ -233,7 +233,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.disable721TokenTemplate, this.contract.methods.disable721TokenTemplate,
templateIndex templateIndex
) )
@ -274,7 +274,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.reactivate721TokenTemplate, this.contract.methods.reactivate721TokenTemplate,
templateIndex templateIndex
) )
@ -311,7 +311,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.addTokenTemplate, this.contract.methods.addTokenTemplate,
templateAddress templateAddress
) )
@ -354,7 +354,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.disableTokenTemplate, this.contract.methods.disableTokenTemplate,
templateIndex templateIndex
) )
@ -398,7 +398,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.reactivateTokenTemplate, this.contract.methods.reactivateTokenTemplate,
templateIndex templateIndex
) )
@ -438,7 +438,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.startMultipleTokenOrder, this.contract.methods.startMultipleTokenOrder,
orders orders
) )
@ -475,7 +475,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.createNftWithErc20, this.contract.methods.createNftWithErc20,
nftCreateData, nftCreateData,
ercCreateData ercCreateData
@ -517,7 +517,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.createNftWithErc20WithFixedRate, this.contract.methods.createNftWithErc20WithFixedRate,
nftCreateData, nftCreateData,
ercCreateData, ercCreateData,
@ -562,7 +562,7 @@ export class NftFactory extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.createNftWithErc20WithDispenser, this.contract.methods.createNftWithErc20WithDispenser,
nftCreateData, nftCreateData,
ercCreateData, ercCreateData,

View File

@ -35,7 +35,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.buyDTBatch, this.contract.methods.buyDTBatch,
operations operations
) )
@ -97,7 +97,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.addApprovedToken, this.contract.methods.addApprovedToken,
tokenAddress tokenAddress
) )
@ -131,7 +131,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.removeApprovedToken, this.contract.methods.removeApprovedToken,
tokenAddress tokenAddress
) )
@ -164,7 +164,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.addFixedRateContract, this.contract.methods.addFixedRateContract,
tokenAddress tokenAddress
) )
@ -198,7 +198,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.removeFixedRateContract, this.contract.methods.removeFixedRateContract,
tokenAddress tokenAddress
) )
@ -232,7 +232,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.addDispenserContract, this.contract.methods.addDispenserContract,
tokenAddress tokenAddress
) )
@ -265,7 +265,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.removeDispenserContract, this.contract.methods.removeDispenserContract,
tokenAddress tokenAddress
) )
@ -321,7 +321,7 @@ export class Router extends SmartContractWithAddress {
address, address,
estGas + 1, estGas + 1,
this.web3, this.web3,
this.config, this.config?.gasFeeMultiplier,
this.contract.methods.updateOPCFee, this.contract.methods.updateOPCFee,
newSwapOceanFee, newSwapOceanFee,
newSwapNonOceanFee, newSwapNonOceanFee,

View File

@ -51,7 +51,7 @@ export abstract class SmartContract {
} }
protected async getFairGasPrice(): Promise<string> { protected async getFairGasPrice(): Promise<string> {
return getFairGasPrice(this.web3, this.config) return getFairGasPrice(this.web3, this.config?.gasFeeMultiplier)
} }
protected getContract( protected getContract(

View File

@ -16,20 +16,14 @@ export function setContractDefaults(contract: Contract, config: Config): Contrac
return contract return contract
} }
export async function networkSupportsEip1559(web3: Web3): Promise<boolean> { export async function getFairGasPrice(
const feeHistory = await web3.eth.getFeeHistory(4, 'pending', [25, 50, 75]) web3: Web3,
if (feeHistory && feeHistory.baseFeePerGas) { gasFeeMultiplier: number
return true ): Promise<string> {
} else {
return false
}
}
export async function getFairGasPrice(web3: Web3, config: Config): Promise<string> {
const x = new BigNumber(await web3.eth.getGasPrice()) const x = new BigNumber(await web3.eth.getGasPrice())
if (config && config.gasFeeMultiplier) if (gasFeeMultiplier)
return x return x
.multipliedBy(config.gasFeeMultiplier) .multipliedBy(gasFeeMultiplier)
.integerValue(BigNumber.ROUND_DOWN) .integerValue(BigNumber.ROUND_DOWN)
.toString(10) .toString(10)
else return x.toString(10) else return x.toString(10)
@ -97,7 +91,7 @@ export async function calculateEstimatedGas(
* @param {string} from account that calls the function * @param {string} from account that calls the function
* @param {any} estGas estimated gas for the transaction * @param {any} estGas estimated gas for the transaction
* @param {Web3} web3 web3 objcet * @param {Web3} web3 web3 objcet
* @param {Function} functionToEstimateGas function that we need to send * @param {Function} functionToSend function that we need to send
* @param {...any[]} args arguments of the function * @param {...any[]} args arguments of the function
* @return {Promise<any>} transaction receipt * @return {Promise<any>} transaction receipt
*/ */
@ -105,7 +99,7 @@ export async function sendTx(
from: string, from: string,
estGas: any, estGas: any,
web3: Web3, web3: Web3,
config: Config, gasFeeMultiplier: number,
functionToSend: Function, functionToSend: Function,
...args: any[] ...args: any[]
): Promise<any> { ): Promise<any> {
@ -116,8 +110,8 @@ export async function sendTx(
try { try {
const feeHistory = await web3.eth.getFeeHistory(1, 'latest', [75]) const feeHistory = await web3.eth.getFeeHistory(1, 'latest', [75])
let aggressiveFee = new BigNumber(feeHistory?.reward?.[0]?.[0]) let aggressiveFee = new BigNumber(feeHistory?.reward?.[0]?.[0])
if (this.config?.gasFeeMultiplier > 1) { if (gasFeeMultiplier > 1) {
aggressiveFee = aggressiveFee.multipliedBy(this.config?.gasFeeMultiplier) aggressiveFee = aggressiveFee.multipliedBy(gasFeeMultiplier)
} }
sendTxValue.maxPriorityFeePerGas = aggressiveFee sendTxValue.maxPriorityFeePerGas = aggressiveFee
@ -130,7 +124,7 @@ export async function sendTx(
.toString(10) .toString(10)
} catch (err) { } catch (err) {
LoggerInstance.error('Not able to use EIP 1559.') LoggerInstance.error('Not able to use EIP 1559.')
sendTxValue.gasPrice = await getFairGasPrice(web3, config) sendTxValue.gasPrice = await getFairGasPrice(web3, gasFeeMultiplier)
} }
const trxReceipt = await functionToSend.apply(null, args).send(sendTxValue) const trxReceipt = await functionToSend.apply(null, args).send(sendTxValue)

View File

@ -52,7 +52,7 @@ export async function approve<G extends boolean = false>(
account, account,
estGas + 1, estGas + 1,
web3, web3,
config, config?.gasFeeMultiplier,
tokenContract.methods.approve, tokenContract.methods.approve,
spender, spender,
amountFormatted amountFormatted
@ -100,7 +100,7 @@ export async function approveWei<G extends boolean = false>(
account, account,
estGas + 1, estGas + 1,
web3, web3,
config, config?.gasFeeMultiplier,
tokenContract.methods.approve, tokenContract.methods.approve,
spender, spender,
amount amount
@ -145,7 +145,7 @@ export async function transfer<G extends boolean = false>(
account, account,
estGas + 1, estGas + 1,
web3, web3,
config, config?.gasFeeMultiplier,
tokenContract.methods.transfer, tokenContract.methods.transfer,
recipient, recipient,
amountFormatted amountFormatted