1、gasprice溢价
2、重复添加token校验
This commit is contained in:
@ -58,6 +58,8 @@ func TransferEth(client *ethclient.Client, fromPrivateKey string, toAddress stri
|
||||
return nil, fmt.Errorf("获取 Gas 价格失败: %w", err)
|
||||
}
|
||||
|
||||
gasPrice = new(big.Int).Mul(gasPrice, big.NewInt(11))
|
||||
gasPrice = new(big.Int).Div(gasPrice, big.NewInt(10))
|
||||
// 6. 将地址字符串转换为 common.Address 类型
|
||||
toAddressCommon := common.HexToAddress(toAddress)
|
||||
|
||||
@ -145,6 +147,8 @@ func TransferErc20Token(
|
||||
return nil, fmt.Errorf("获取 Gas 价格失败: %w", err)
|
||||
}
|
||||
|
||||
gasPrice = new(big.Int).Mul(gasPrice, big.NewInt(11))
|
||||
gasPrice = new(big.Int).Div(gasPrice, big.NewInt(10))
|
||||
// 6. 将地址字符串转换为 common.Address 类型
|
||||
toAddressCommon := common.HexToAddress(toAddress)
|
||||
tokenAddressCommon := common.HexToAddress(tokenAddress)
|
||||
|
||||
Reference in New Issue
Block a user