修改eth转账的gas计算
This commit is contained in:
parent
c22af27f48
commit
eaebdbb80e
@ -14,6 +14,7 @@ import assert from 'assert'
|
||||
import { IPriceData } from 'structs/PriceData'
|
||||
import { IChainData } from 'structs/ChainData'
|
||||
import { PriceSvr } from 'service/price.service'
|
||||
import { CHAIN_GAS_BOOST } from 'common/Constants'
|
||||
|
||||
@singleton
|
||||
export class BlockChain {
|
||||
@ -121,7 +122,7 @@ export class BlockChain {
|
||||
return this.web3.eth.sendTransaction({
|
||||
from,
|
||||
to,
|
||||
gas: 21000,
|
||||
gas: (gas * CHAIN_GAS_BOOST) | 0,
|
||||
value: amountToSend,
|
||||
})
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import { Contract } from 'web3-eth-contract'
|
||||
import { Account } from 'web3-core'
|
||||
import { AllChains } from './allchain'
|
||||
import { HttpRetryProvider } from './HttpRetryProvider'
|
||||
import { CHAIN_GAS_BOOST } from 'common/Constants'
|
||||
|
||||
const abiFt = require('abis/ERC20.json').abi
|
||||
export class ERC20Reactor {
|
||||
@ -150,6 +151,7 @@ export class ERC20Reactor {
|
||||
from === this.account.address
|
||||
? await contract.methods.transfer(to, amountBN).estimateGas()
|
||||
: await contract.methods.transferFrom(from, to, amountBN).estimateGas()
|
||||
gasEstimate = (gasEstimate * CHAIN_GAS_BOOST) | 0
|
||||
if (estimate) {
|
||||
return gasEstimate
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ export const AllChains = [
|
||||
{
|
||||
name: 'Arbitrum One',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://endpoints.omniatech.io/v1/arbitrum/one/public|https://rpc.ankr.com/arbitrum',
|
||||
rpc: 'https://arb1.arbitrum.io/rpc',
|
||||
id: 42161,
|
||||
network: 'ARBITRUM',
|
||||
symbol: 'ETH',
|
||||
|
@ -11,3 +11,5 @@ export const CONFIRM_MAIL_HTML = `
|
||||
<p>点击链接进入确认页面, 如果无法跳转, 就复制链接, 电脑上直接用浏览器打开, 手机上使用MetaMask的浏览器打开</p>
|
||||
<p><a href="{{link}}" target="_blank">{{link2}}</a></p>
|
||||
`
|
||||
|
||||
export const CHAIN_GAS_BOOST = 1.3
|
||||
|
Loading…
x
Reference in New Issue
Block a user