eth_estimateGas (#128)

* Draft eth_estimateGas
* implemented eth_estimateGas
* refactored doCall to be used for both eth_call and eth_estiamteGas

* updated to reflect requested changes

* moved GenerateFromArgs func

* removed todo

* revert comment

* fixes dereference issue

* gofmted
This commit is contained in:
Dustin Brickwood
2019-10-30 13:30:24 -05:00
committed by GitHub
parent 741dfeb461
commit 69e0873dd9
6 changed files with 115 additions and 103 deletions
+4 -3
View File
@@ -71,9 +71,9 @@ func GetCmdGenTx(cdc *codec.Codec) *cobra.Command {
}
payload := args[4]
addr := ethcmn.HexToAddress(args[0])
// TODO: Remove explicit photon check and check variables
msg := types.NewEthereumTxMsg(0, ethcmn.HexToAddress(args[0]), big.NewInt(coins.AmountOf(emintTypes.DenomDefault).Int64()), gasLimit, new(big.Int).SetUint64(gasPrice), []byte(payload))
msg := types.NewEthereumTxMsg(0, &addr, big.NewInt(coins.AmountOf(emintTypes.DenomDefault).Int64()), gasLimit, new(big.Int).SetUint64(gasPrice), []byte(payload))
err = msg.ValidateBasic()
if err != nil {
return err
@@ -125,7 +125,8 @@ func GetCmdGenETHTx(cdc *codec.Codec) *cobra.Command {
var tx *types.EthereumTxMsg
if len(args) == 5 {
tx = types.NewEthereumTxMsg(txBldr.Sequence(), ethcmn.HexToAddress(args[4]), big.NewInt(coins.AmountOf(emintTypes.DenomDefault).Int64()), gasLimit, new(big.Int).SetUint64(gasPrice), []byte(payload))
addr := ethcmn.HexToAddress(args[4])
tx = types.NewEthereumTxMsg(txBldr.Sequence(), &addr, big.NewInt(coins.AmountOf(emintTypes.DenomDefault).Int64()), gasLimit, new(big.Int).SetUint64(gasPrice), []byte(payload))
} else {
tx = types.NewEthereumTxMsgContract(txBldr.Sequence(), big.NewInt(coins.AmountOf(emintTypes.DenomDefault).Int64()), gasLimit, new(big.Int).SetUint64(gasPrice), []byte(payload))
}