|
|
@@ -43,7 +43,7 @@ func (h *HistoryArbitrage) callReturnRealResult(a abi.ABI, from string, to strin
|
|
|
return realResult, nil
|
|
|
}
|
|
|
|
|
|
-func (h *HistoryArbitrage) SendTest(e *EasyWallet) {
|
|
|
+func (h *HistoryArbitrage) sendTest(e *EasyWallet) {
|
|
|
ctx := context.Background()
|
|
|
blockOrNbr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
|
|
|
|
|
|
@@ -55,7 +55,11 @@ func (h *HistoryArbitrage) SendTest(e *EasyWallet) {
|
|
|
}
|
|
|
|
|
|
gasLimit := hexutil.Uint64(uint64(21000))
|
|
|
- gasPrice := hexutil.Big(*big.NewInt(30 * 1e9))
|
|
|
+ gasPrice, err := h.ethereumApi.GasPrice(ctx)
|
|
|
+ if err != nil {
|
|
|
+ HistoryError("Get gas price error.", "error", err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
callData := hexutil.Bytes{}
|
|
|
value := hexutil.Big(*big.NewInt(1))
|
|
|
fromAddr := e.account.Address
|
|
|
@@ -64,7 +68,7 @@ func (h *HistoryArbitrage) SendTest(e *EasyWallet) {
|
|
|
sendArgs := ethapi.SendTxArgs{
|
|
|
Nonce: nonce,
|
|
|
Gas: &gasLimit,
|
|
|
- GasPrice: &gasPrice,
|
|
|
+ GasPrice: gasPrice,
|
|
|
Data: &callData,
|
|
|
Value: &value,
|
|
|
From: fromAddr,
|
|
|
@@ -79,23 +83,3 @@ func (h *HistoryArbitrage) SendTest(e *EasyWallet) {
|
|
|
|
|
|
HistoryInfo("Send ok.", "hash", hash)
|
|
|
}
|
|
|
-
|
|
|
-func GetFinalParams(params []interface{}) []interface{} {
|
|
|
- var finalParams []interface{}
|
|
|
-
|
|
|
- for _, value := range params {
|
|
|
- if intValue, ok := value.(int); ok {
|
|
|
- finalParams = append(finalParams, big.NewInt(int64(intValue)))
|
|
|
- } else {
|
|
|
- finalParams = append(finalParams, value)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return finalParams
|
|
|
-}
|
|
|
-
|
|
|
-func FinalPack(a abi.ABI, method string, params ...interface{}) (hexutil.Bytes, error) {
|
|
|
- data, err := a.Pack(method, params...)
|
|
|
-
|
|
|
- return data, err
|
|
|
-}
|