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:
parent
a5e5d69241
commit
16a1f0b094
@ -73,7 +73,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.approve,
|
||||
spender,
|
||||
this.web3.utils.toWei(amount)
|
||||
@ -129,7 +129,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.createFixedRate,
|
||||
fixedRateParams.fixedRateAddress,
|
||||
[
|
||||
@ -191,7 +191,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.createDispenser,
|
||||
dispenserAddress,
|
||||
dispenserParams.maxTokens,
|
||||
@ -237,7 +237,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.mint,
|
||||
toAddress || address,
|
||||
this.web3.utils.toWei(amount)
|
||||
@ -279,7 +279,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.addMinter,
|
||||
minter
|
||||
)
|
||||
@ -319,7 +319,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.removeMinter,
|
||||
minter
|
||||
)
|
||||
@ -358,7 +358,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.addPaymentManager,
|
||||
paymentManager
|
||||
)
|
||||
@ -397,7 +397,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.removePaymentManager,
|
||||
paymentManager
|
||||
)
|
||||
@ -443,7 +443,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.setPaymentCollector,
|
||||
paymentCollector
|
||||
)
|
||||
@ -507,7 +507,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.transfer,
|
||||
toAddress,
|
||||
amount
|
||||
@ -556,7 +556,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.startOrder,
|
||||
consumer,
|
||||
serviceIndex,
|
||||
@ -596,7 +596,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.reuseOrder,
|
||||
orderTxId,
|
||||
providerFees
|
||||
@ -634,7 +634,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.buyFromFreAndOrder,
|
||||
orderParams,
|
||||
freContractParams
|
||||
@ -670,7 +670,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.buyFromDispenserAndOrder,
|
||||
orderParams,
|
||||
dispenserContract
|
||||
@ -711,7 +711,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.setData,
|
||||
valueHex
|
||||
)
|
||||
@ -746,7 +746,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.cleanPermissions
|
||||
)
|
||||
|
||||
@ -856,7 +856,7 @@ export class Datatoken extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
dtContract.methods.setPublishingMarketFee,
|
||||
publishMarketFeeAddress,
|
||||
publishMarketFeeToken,
|
||||
|
@ -61,7 +61,7 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.create,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
@ -101,7 +101,7 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.activate,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
@ -133,7 +133,7 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.deactivate,
|
||||
dtAddress
|
||||
)
|
||||
@ -166,7 +166,7 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.setAllowedSwapper,
|
||||
dtAddress,
|
||||
newAllowedSwapper
|
||||
@ -204,7 +204,7 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.dispense,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(amount),
|
||||
@ -235,7 +235,7 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.ownerWithdraw,
|
||||
dtAddress
|
||||
)
|
||||
|
@ -70,7 +70,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.buyDT,
|
||||
exchangeId,
|
||||
dtAmountFormatted,
|
||||
@ -128,7 +128,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.sellDT,
|
||||
exchangeId,
|
||||
dtAmountFormatted,
|
||||
@ -175,7 +175,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.setRate,
|
||||
exchangeId,
|
||||
this.web3.utils.toWei(newRate)
|
||||
@ -209,7 +209,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.setAllowedSwapper,
|
||||
exchangeId,
|
||||
newAllowedSwapper
|
||||
@ -242,7 +242,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.toggleExchangeState,
|
||||
exchangeId
|
||||
)
|
||||
@ -275,7 +275,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.toggleExchangeState,
|
||||
exchangeId
|
||||
)
|
||||
@ -510,7 +510,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.toggleMintState,
|
||||
exchangeId,
|
||||
true
|
||||
@ -545,7 +545,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.toggleMintState,
|
||||
exchangeId,
|
||||
false
|
||||
@ -590,7 +590,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.collectBT,
|
||||
exchangeId,
|
||||
amountWei
|
||||
@ -635,7 +635,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.collectDT,
|
||||
exchangeId,
|
||||
amountWei
|
||||
@ -668,7 +668,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.collectMarketFee,
|
||||
exchangeId
|
||||
)
|
||||
@ -701,7 +701,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.collectOceanFee,
|
||||
exchangeId
|
||||
)
|
||||
@ -762,7 +762,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.updateMarketFee,
|
||||
exchangeId,
|
||||
this.web3.utils.toWei(newMarketFee)
|
||||
@ -796,7 +796,7 @@ export class FixedRateExchange extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.updateMarketFeeCollector,
|
||||
exchangeId,
|
||||
newMarketFeeCollector
|
||||
|
@ -67,7 +67,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.createERC20,
|
||||
templateIndex,
|
||||
[name, symbol],
|
||||
@ -109,7 +109,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.addManager,
|
||||
manager
|
||||
)
|
||||
@ -147,7 +147,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.removeManager,
|
||||
manager
|
||||
)
|
||||
@ -186,7 +186,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.addToCreateERC20List,
|
||||
datatokenDeployer
|
||||
)
|
||||
@ -227,7 +227,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.removeFromCreateERC20List,
|
||||
datatokenDeployer
|
||||
)
|
||||
@ -265,7 +265,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.addToMetadataList,
|
||||
metadataUpdater
|
||||
)
|
||||
@ -306,7 +306,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.removeFromMetadataList,
|
||||
metadataUpdater
|
||||
)
|
||||
@ -343,7 +343,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.addTo725StoreList,
|
||||
storeUpdater
|
||||
)
|
||||
@ -385,7 +385,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.removeFrom725StoreList,
|
||||
storeUpdater
|
||||
)
|
||||
@ -423,7 +423,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.cleanPermissions
|
||||
)
|
||||
|
||||
@ -467,7 +467,7 @@ export class Nft extends SmartContract {
|
||||
nftOwner,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.transferFrom,
|
||||
nftOwner,
|
||||
nftReceiver,
|
||||
@ -514,7 +514,7 @@ export class Nft extends SmartContract {
|
||||
nftOwner,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.safeTransferFrom,
|
||||
nftOwner,
|
||||
nftReceiver,
|
||||
@ -570,7 +570,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.setMetaData,
|
||||
metadataState,
|
||||
metadataDecryptorUrl,
|
||||
@ -616,7 +616,7 @@ export class Nft extends SmartContract {
|
||||
metadataUpdater,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.setMetaDataAndTokenURI,
|
||||
sanitizedMetadataAndTokenURI
|
||||
)
|
||||
@ -654,7 +654,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.setMetaDataState,
|
||||
metadataState
|
||||
)
|
||||
@ -687,7 +687,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.setTokenURI,
|
||||
'1',
|
||||
data
|
||||
@ -774,7 +774,7 @@ export class Nft extends SmartContract {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
nftContract.methods.setNewData,
|
||||
keyHash,
|
||||
valueHex
|
||||
|
@ -68,7 +68,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.deployERC721Contract,
|
||||
nftData.name,
|
||||
nftData.symbol,
|
||||
@ -194,7 +194,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.add721TokenTemplate,
|
||||
templateAddress
|
||||
)
|
||||
@ -233,7 +233,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.disable721TokenTemplate,
|
||||
templateIndex
|
||||
)
|
||||
@ -274,7 +274,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.reactivate721TokenTemplate,
|
||||
templateIndex
|
||||
)
|
||||
@ -311,7 +311,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.addTokenTemplate,
|
||||
templateAddress
|
||||
)
|
||||
@ -354,7 +354,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.disableTokenTemplate,
|
||||
templateIndex
|
||||
)
|
||||
@ -398,7 +398,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.reactivateTokenTemplate,
|
||||
templateIndex
|
||||
)
|
||||
@ -438,7 +438,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.startMultipleTokenOrder,
|
||||
orders
|
||||
)
|
||||
@ -475,7 +475,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.createNftWithErc20,
|
||||
nftCreateData,
|
||||
ercCreateData
|
||||
@ -517,7 +517,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.createNftWithErc20WithFixedRate,
|
||||
nftCreateData,
|
||||
ercCreateData,
|
||||
@ -562,7 +562,7 @@ export class NftFactory extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.createNftWithErc20WithDispenser,
|
||||
nftCreateData,
|
||||
ercCreateData,
|
||||
|
@ -35,7 +35,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.buyDTBatch,
|
||||
operations
|
||||
)
|
||||
@ -97,7 +97,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.addApprovedToken,
|
||||
tokenAddress
|
||||
)
|
||||
@ -131,7 +131,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.removeApprovedToken,
|
||||
tokenAddress
|
||||
)
|
||||
@ -164,7 +164,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.addFixedRateContract,
|
||||
tokenAddress
|
||||
)
|
||||
@ -198,7 +198,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.removeFixedRateContract,
|
||||
tokenAddress
|
||||
)
|
||||
@ -232,7 +232,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.addDispenserContract,
|
||||
tokenAddress
|
||||
)
|
||||
@ -265,7 +265,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.removeDispenserContract,
|
||||
tokenAddress
|
||||
)
|
||||
@ -321,7 +321,7 @@ export class Router extends SmartContractWithAddress {
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.config?.gasFeeMultiplier,
|
||||
this.contract.methods.updateOPCFee,
|
||||
newSwapOceanFee,
|
||||
newSwapNonOceanFee,
|
||||
|
@ -51,7 +51,7 @@ export abstract class SmartContract {
|
||||
}
|
||||
|
||||
protected async getFairGasPrice(): Promise<string> {
|
||||
return getFairGasPrice(this.web3, this.config)
|
||||
return getFairGasPrice(this.web3, this.config?.gasFeeMultiplier)
|
||||
}
|
||||
|
||||
protected getContract(
|
||||
|
@ -16,20 +16,14 @@ export function setContractDefaults(contract: Contract, config: Config): Contrac
|
||||
return contract
|
||||
}
|
||||
|
||||
export async function networkSupportsEip1559(web3: Web3): Promise<boolean> {
|
||||
const feeHistory = await web3.eth.getFeeHistory(4, 'pending', [25, 50, 75])
|
||||
if (feeHistory && feeHistory.baseFeePerGas) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export async function getFairGasPrice(web3: Web3, config: Config): Promise<string> {
|
||||
export async function getFairGasPrice(
|
||||
web3: Web3,
|
||||
gasFeeMultiplier: number
|
||||
): Promise<string> {
|
||||
const x = new BigNumber(await web3.eth.getGasPrice())
|
||||
if (config && config.gasFeeMultiplier)
|
||||
if (gasFeeMultiplier)
|
||||
return x
|
||||
.multipliedBy(config.gasFeeMultiplier)
|
||||
.multipliedBy(gasFeeMultiplier)
|
||||
.integerValue(BigNumber.ROUND_DOWN)
|
||||
.toString(10)
|
||||
else return x.toString(10)
|
||||
@ -97,7 +91,7 @@ export async function calculateEstimatedGas(
|
||||
* @param {string} from account that calls the function
|
||||
* @param {any} estGas estimated gas for the transaction
|
||||
* @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
|
||||
* @return {Promise<any>} transaction receipt
|
||||
*/
|
||||
@ -105,7 +99,7 @@ export async function sendTx(
|
||||
from: string,
|
||||
estGas: any,
|
||||
web3: Web3,
|
||||
config: Config,
|
||||
gasFeeMultiplier: number,
|
||||
functionToSend: Function,
|
||||
...args: any[]
|
||||
): Promise<any> {
|
||||
@ -116,8 +110,8 @@ export async function sendTx(
|
||||
try {
|
||||
const feeHistory = await web3.eth.getFeeHistory(1, 'latest', [75])
|
||||
let aggressiveFee = new BigNumber(feeHistory?.reward?.[0]?.[0])
|
||||
if (this.config?.gasFeeMultiplier > 1) {
|
||||
aggressiveFee = aggressiveFee.multipliedBy(this.config?.gasFeeMultiplier)
|
||||
if (gasFeeMultiplier > 1) {
|
||||
aggressiveFee = aggressiveFee.multipliedBy(gasFeeMultiplier)
|
||||
}
|
||||
|
||||
sendTxValue.maxPriorityFeePerGas = aggressiveFee
|
||||
@ -130,7 +124,7 @@ export async function sendTx(
|
||||
.toString(10)
|
||||
} catch (err) {
|
||||
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)
|
||||
|
@ -52,7 +52,7 @@ export async function approve<G extends boolean = false>(
|
||||
account,
|
||||
estGas + 1,
|
||||
web3,
|
||||
config,
|
||||
config?.gasFeeMultiplier,
|
||||
tokenContract.methods.approve,
|
||||
spender,
|
||||
amountFormatted
|
||||
@ -100,7 +100,7 @@ export async function approveWei<G extends boolean = false>(
|
||||
account,
|
||||
estGas + 1,
|
||||
web3,
|
||||
config,
|
||||
config?.gasFeeMultiplier,
|
||||
tokenContract.methods.approve,
|
||||
spender,
|
||||
amount
|
||||
@ -145,7 +145,7 @@ export async function transfer<G extends boolean = false>(
|
||||
account,
|
||||
estGas + 1,
|
||||
web3,
|
||||
config,
|
||||
config?.gasFeeMultiplier,
|
||||
tokenContract.methods.transfer,
|
||||
recipient,
|
||||
amountFormatted
|
||||
|
Loading…
x
Reference in New Issue
Block a user