// Copyright Rivtower Technologies LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package evm;

import "common.proto";
import "blockchain.proto";
import "executor.proto";

message Receipt {
  bytes transaction_hash = 1;
  uint64 transaction_index = 2;
  bytes block_hash = 3;
  uint64 block_number = 4;
  bytes cumulative_quota_used = 5;
  bytes quota_used = 6;
  bytes contract_address = 7;
  repeated Log logs = 8;
  bytes state_root = 9;
  bytes logs_bloom = 10;
  string error_message = 11;
}

message Log {
  bytes address = 1;
  repeated bytes topics = 2;
  bytes data = 3;
  bytes block_hash = 4;
  uint64 block_number = 5;
  bytes transaction_hash = 6;
  uint64 transaction_index = 7;
  uint64 log_index = 8;
  uint64 transaction_log_index = 9;
}

message ByteCode {
  bytes byte_code = 1;
}

message Balance {
  bytes value = 1;
}

message Nonce {
  bytes nonce = 1;
}

message ByteAbi {
  bytes bytes_abi = 1;
}

message ByteQuota {
  bytes bytes_quota = 1;
}

service RPCService {
  rpc GetTransactionReceipt(common.Hash) returns (Receipt);

  rpc GetCode(common.Address) returns (ByteCode);

  rpc GetBalance(common.Address) returns (Balance);

  rpc GetTransactionCount(common.Address) returns (Nonce);

  rpc GetAbi(common.Address) returns (ByteAbi);

  rpc EstimateQuota(executor.CallRequest) returns (ByteQuota);
}
