syntax = "proto3";
package ethermint.evm.v1alpha1;

import "gogoproto/gogo.proto";
import "ethermint/evm/v1alpha1/evm.proto";

option go_package = "github.com/cosmos/ethermint/x/evm/types";

// Msg defines the evm Msg service.
service Msg {
  // EthereumTx defines a method submitting Ethereum transactions.
  rpc EthereumTx(MsgEthereumTx) returns (MsgEthereumTxResponse);
}

// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.
message MsgEthereumTx {
  option (gogoproto.goproto_getters) = false;

  // inner transaction data
  TxData data = 1;
  // caches

  // encoded storage size of the transaction
  double size = 2 [(gogoproto.jsontag) = "-"];
  // transaction hash in hex format
  string hash = 3 [(gogoproto.moretags) = "rlp:\"-\""];
  // ethereum signer address in hex format. This address value is checked against
  // the address derived from the signature (V, R, S) using the secp256k1
  // elliptic curve
  string from = 4;
}

message ExtensionOptionsEthereumTx {
  option (gogoproto.goproto_getters) = false;
}

message ExtensionOptionsWeb3Tx {
  option (gogoproto.goproto_getters) = false;
}

// MsgEthereumTxResponse defines the Msg/EthereumTx response type.
message MsgEthereumTxResponse {
  option (gogoproto.goproto_getters) = false;

  // contract_address contains the ethereum address of the created contract (if
  // any). If the state transition is an evm.Call, the contract address will be
  // empty.
  string contract_address = 1 [(gogoproto.moretags) = "yaml:\"contract_address\""];
  // bloom represents the bloom filter bytes
  bytes bloom = 2;
  // tx_logs contains the transaction hash and the proto-compatible ethereum
  // logs.
  TransactionLogs tx_logs = 3 [(gogoproto.moretags) = "yaml:\"tx_logs\"", (gogoproto.nullable) = false];
  // ret defines the bytes from the execution.
  bytes ret = 4;
  // reverted flag is set to true when the call has been reverted
  bool reverted = 5;
}

// // SigCache is used to cache the derived sender and contains the signer used
// // to derive it.
// message SigCache {
//   option (gogoproto.goproto_getters) = false;

//   EIP155Signer signer  = 1;
//   bytes        address = 2;
// }

// // EIP155Transaction implements Signer using the EIP155 rules.
// message EIP155Signer {
//   option (gogoproto.goproto_getters) = false;

//   bytes chain_id     = 1 [(gogoproto.customname) = "chainId"];
//   bytes chain_id_mul = 2 [(gogoproto.customname) = "chainIdMul"];
// }
