1、gasprice溢价

2、重复添加token校验
This commit is contained in:
2025-05-20 09:11:13 +08:00
parent 8113868cc0
commit 6865518a9f
3 changed files with 21 additions and 1 deletions

View File

@ -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)