1、调整gas费浮动比例为90%
This commit is contained in:
@ -28,7 +28,7 @@ func TransferErc20(
|
||||
tokenAmount decimal.Decimal,
|
||||
tokenDecimals uint8) (*types.Transaction, error) {
|
||||
switch tokenAddress {
|
||||
case "":
|
||||
case "0":
|
||||
return TransferEth(client, fromPrivateKey, toAddress, tokenAmount)
|
||||
default:
|
||||
return TransferErc20Token(client, fromPrivateKey, tokenAddress, toAddress, tokenAmount, tokenDecimals)
|
||||
@ -81,7 +81,7 @@ func TransferEth(client *ethclient.Client, fromPrivateKey string, toAddress stri
|
||||
}
|
||||
|
||||
// 9. (预估gas+基础费用)*1.1 作为 GasLimit
|
||||
gasLimit = (gasLimit + 21000) * 12 / 10 // 增加 20%
|
||||
gasLimit = (gasLimit + 21000) * 19 / 10 // 增加 90%
|
||||
if gasLimit < 23000 {
|
||||
gasLimit = 23000 // 最小 Gas 限制
|
||||
}
|
||||
@ -182,7 +182,7 @@ func TransferErc20Token(
|
||||
}
|
||||
|
||||
// 9. (预估gas+基础费用)*1.1 作为 GasLimit
|
||||
gasLimit = (gasLimit + 21000) * 12 / 10 // 增加 20%
|
||||
gasLimit = (gasLimit + 21000) * 19 / 10 // 增加 90%
|
||||
if gasLimit < 23000 {
|
||||
gasLimit = 23000 // 最小 Gas 限制
|
||||
}
|
||||
@ -274,5 +274,5 @@ func IsValidAddress(address string) bool {
|
||||
}
|
||||
|
||||
checksumAddress := common.HexToAddress(address).String()
|
||||
return address == checksumAddress
|
||||
return strings.EqualFold(address, checksumAddress)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user