syntax = "proto3";

package protocol;

option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
//option java_outer_classname = "FreezeBalanceContract"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/grpc-gateway/core";

import "core/contract/common.proto";

message FreezeBalanceContract {
  bytes owner_address = 1;
  int64 frozen_balance = 2;
  int64 frozen_duration = 3;

  ResourceCode resource = 10;
  bytes receiver_address = 15;
}


message UnfreezeBalanceContract {
  bytes owner_address = 1;

  ResourceCode resource = 10;
  bytes receiver_address = 15;
}

message WithdrawBalanceContract {
  bytes owner_address = 1;
}

message TransferContract {
  bytes owner_address = 1;
  bytes to_address = 2;
  int64 amount = 3;
}

message TransactionBalanceTrace {
  message Operation {
    int64 operation_identifier = 1;
    bytes address = 2;
    int64 amount = 3;
  }

  bytes transaction_identifier = 1;
  repeated Operation operation = 2;
  string type = 3;
  string status = 4;
}



message BlockBalanceTrace {
  message BlockIdentifier {
    bytes hash = 1;
    int64 number = 2;
  }

  BlockIdentifier block_identifier = 1;
  int64 timestamp = 2;
  repeated TransactionBalanceTrace transaction_balance_trace = 3;
//  BlockIdentifier parent_block_identifier = 4;
}

message AccountTrace {
  int64 balance = 1;
  int64 placeholder = 99;
}

message AccountIdentifier {
  bytes address = 1;
}

message AccountBalanceRequest {
  AccountIdentifier account_identifier = 1;
  BlockBalanceTrace.BlockIdentifier block_identifier = 2;
}

message AccountBalanceResponse {
  int64 balance = 1;
  BlockBalanceTrace.BlockIdentifier block_identifier = 2;
}

message FreezeBalanceV2Contract {
  bytes owner_address = 1;
  int64 frozen_balance = 2;
  ResourceCode resource = 3;
}

message UnfreezeBalanceV2Contract {
  bytes owner_address = 1;
  int64 unfreeze_balance = 2;
  ResourceCode resource = 3;
}

message WithdrawExpireUnfreezeContract {
  bytes owner_address = 1;
}

message DelegateResourceContract {
  bytes owner_address = 1;
  ResourceCode resource = 2;
  int64 balance = 3;
  bytes receiver_address = 4;
  bool  lock = 5;
  int64 lock_period = 6;
}

message UnDelegateResourceContract {
  bytes owner_address = 1;
  ResourceCode resource = 2;
  int64 balance = 3;
  bytes receiver_address = 4;
}

message CancelAllUnfreezeV2Contract {
  bytes owner_address = 1;
}