syntax = "proto3";


option java_multiple_files = true;
option java_package = "com.binance.dex.api.proto";
option java_outer_classname = "Transaction";

package transaction;
// import "types.proto";
import "google/protobuf/timestamp.proto";

// please note the field name is the JSON name.
message StdTx {
    //    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding
    //    0xF0625DEE   // hardcoded, object type prefix in 4 bytes
    repeated bytes msgs = 1; // array of size 1, containing the transaction message, which are one of the transaction type below
    repeated bytes signatures = 2; // array of size 1, containing the standard signature structure of the transaction sender
    string memo = 3; // a short sentence of remark for the transaction. Please only `Transfer` transaction allows 'memo' input, and other transactions with non-empty `Memo` would be rejected.
    int64 source = 4; // an identifier for tools triggerring this transaction, set to zero if unwilling to disclose.
    bytes data = 5; //byte array, reserved for future use
}

message StdSignature {
    // please note there is no type prefix for StdSignature
    message PubKey {
        //        0xEB5AE987 // hardcoded, object type prefix in 4 bytes
        //        bytes // no name or field id, just encode the bytes
    }
    bytes pub_key = 1; // public key bytes of the signer address
    bytes signature = 2; // signature bytes, please check chain access section for signature generation
    int64 account_number = 3; // another identifier of signer, which can be read from chain by account REST API or RPC
    int64 sequence = 4; // sequence number for the next transaction of the client, which can be read fro chain by account REST API or RPC. please check chain acces section for details.
}

// please note the field name is the JSON name.
// msg
message NewOrder {
    //    0xCE6DC043 // hardcoded, object type prefix in 4 bytes
    bytes sender = 1; // order originating address
    string id = 2; // order id, optional
    string symbol = 3; // symbol for trading pair in full name of the tokens
    int64 ordertype = 4; // only accept 2 for now, meaning limit order
    int64 side = 5; // 1 for buy and 2 fory sell
    int64 price = 6; // price of the order, which is the real price multiplied by 1e8 (10^8) and rounded to integer
    int64 quantity = 7; // quantity of the order, which is the real price multiplied by 1e8 (10^8) and rounded to integer
    int64 timeinforce = 8; // 1 for Good Till Expire(GTE) order and 3 for Immediate Or Cancel (IOC)
}

// please note the field name is the JSON name.
// msg
message CancelOrder {
    //    0x166E681B   // hardcoded, object type prefix in 4 bytes
    bytes sender = 1; // order originating address'
    string symbol = 2; // symbol for trading pair in full name of the tokens
    string refid = 3; // order id of the one to cancel
}

// please note the field name is the JSON name.
// msg
message TokenFreeze {
    //    0xE774B32D   // hardcoded, object type prefix in 4 bytes
    bytes from = 1; // owner address
    string symbol = 2; // token symbol, in full name with "-" suffix
    int64 amount = 3; // amount of token to freeze
}

// please note the field name is the JSON name.
// msg
message TokenUnfreeze {
    //    0x6515FF0D   // hardcoded, object type prefix in 4 bytes
    bytes from = 1; // owner address
    string symbol = 2; // token symbol, in full name with "-" suffix
    int64 amount = 3; // amount of token to freeze
}

// please note the field name is the JSON name.
// msg
message Send {
    //    0x2A2C87FA   // hardcoded, object type prefix in 4 bytes
    message Token {
        string denom = 1;
        int64 amount = 2;
    }
    message Input {
        bytes address = 1;
        repeated Token coins = 2;
    }
    message Output {
        bytes address = 1;
        repeated Token coins = 2;
    }
    repeated Input inputs = 1;
    repeated Output outputs = 2;
}

// please note the field name is the JSON name.
// msg
message Vote {
    //    0xA1CADD36	    // hardcoded, object type prefix in 4 bytes
    int64 proposal_id = 1; // ID of the proposal
    bytes voter = 2; // address of the voter
    int64 option = 3; // option from OptionSet chosen by the voter,
}

message SideVote {
    //    0xE26BA13D	    // hardcoded, object type prefix in 4 bytes
    int64 proposal_id = 1; // ID of the proposal
    bytes voter = 2; // address of the voter
    int64 option = 3; // option from OptionSet chosen by the voter,
    string side_chain_id = 4;
}

message Token {
    string denom = 1;
    int64 amount = 2;
}

message AppAccount {
    //    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding
    //    0x4BDC4C27   // hardcoded, object type prefix in 4 bytes
    message baseAccount {
        bytes address = 1;
        repeated Token coins = 2;
        bytes public_key = 3;
        int64 account_number = 4;
        int64 sequence = 5;
    }
    baseAccount base = 1;
    string name = 2;
    repeated Token frozen = 3;
    repeated Token locked = 4;
}

message AtomicSwapInfo {
    bytes from = 1;
    bytes to   = 2;
    repeated Token out_amount = 3;
    repeated Token in_amount = 4;
    string expected_income = 5;
    bytes recipient_other_chain = 6;
    bytes random_number_hash = 7;
    bytes random_number = 8;
    int64 timestamp = 9;
    bool  cross_chain = 10;
    int64 expire_height = 11;
    int64 index = 12;
    int64 closed_time = 13;
    int32 status = 14;
}

message TokenInfo{
    string name = 1;
    string symbol = 2;
    string original_symbol = 3;
    int64 total_supply = 4;
    bytes owner = 5;
    bool mintable = 6;
}

message MiniTokenInfo{
    string name = 1;
    string symbol = 2;
    string original_symbol = 3;
    int64 total_supply = 4;
    bytes owner = 5;
    bool mintable = 6;
    int32 token_type = 7;
    string token_uri = 8;
}

message DexFeeParam {
    // 0x495A5044
    message DexFeeField {
        string fee_name = 1;
        int64 fee_value = 2;
    }
    repeated DexFeeField dex_fee_fields = 1;
}

message FixedFeeParams {
    // 0xC2A96FA3
    string msg_type = 1;
    int64 fee = 2;
    int32 fee_for = 3;
}

message TransferFeeParam {
    // 0x9A3D2769
    FixedFeeParams fixed_fee_params = 1;
    int64 multi_transfer_fee = 2;
    int64 lower_limit_as_multi = 3;

}

// sync/async response
message ResultBroadcastTx {
    int32 code = 1; //uint32
    bytes data = 2;
    string log = 3;
    bytes hash = 4;
}

// commit response
// message ResultBroadcastTxCommit {
//     types.ResponseCheckTx check_tx = 1;
//     types.ResponseDeliverTx deliver_tx = 2;
//     bytes hash = 3;
//     int64 height = 4;
// }


message Issue {
    //    0x17EFAB80 // hardcoded, object type prefix in 4 bytes
    bytes  from = 1; // issue token owner
    string name = 2;
    string symbol = 3;
    int64 total_supply = 4;
    bool  mintable = 5;
}

message Burn {
    //    0x7ED2D2A0 // hardcoded, object type prefix in 4 bytes
    bytes  from = 1; // issue token owner
    string symbol = 2;
    int64 amount = 3;
}

message Mint {
    // 0x467E0829
    bytes  from = 1; // issue token owner
    string symbol = 2;
    int64 amount = 3;
}

message SubmitProposal {
    // 0xB42D614E
    string title = 1;
    string description = 2;
    int64 proposal_type = 3;
    bytes proposer = 4;
    repeated Token initial_deposit = 5;
    int64  voting_period = 6;
}

message SideSubmitProposal {
    // 0x4ACBF03C
    string title = 1;
    string description = 2;
    int64 proposal_type = 3;
    bytes proposer = 4;
    repeated Token initial_deposit = 5;
    int64  voting_period = 6;
    string side_chain_id = 7;
}

message Deposit {
    // 0xA18A56E5
  int64 proposal_id = 1;
  bytes   depositer = 2;
  repeated Token amount = 3;
}

message SideDeposit {
  // 0x140F2DB4
  int64 proposal_id = 1;
  bytes   depositer = 2;
  repeated Token amount = 3;
  string side_chain_id = 4;
}

message Description {
   string moniker  = 1;
   string identity = 2;
   string website = 3;
   string details = 4;
}

message Commission {
    int64 rate = 1;
    int64 max_rate = 2;
    int64 max_change_rate = 3;
}

message CreateValidator  {
    // 0xEB361D01
  Description description = 1;
  Commission    commission = 2;
  bytes delegator_address  = 3;
  bytes validator_address  = 4;
  bytes  pubkey = 5;
  Token      delegation = 6;
}

message RealCreateValidator {
    // 0xDB6A19FD
    CreateValidator createValidator = 1;
    int64 proposal_id = 2;
}

message RemoveValidator {
 //0xC1AFE85F
  bytes launcher_addr = 1;
  bytes    val_addr = 2;
  bytes val_cons_addr = 3;
  int64 proposal_id = 4;
}

message List {
// 0xB41DE13F
  bytes from  = 1;
   int64          proposal_id = 2;
   string         base_asset_symbol = 3;
   string        quote_asset_symbol = 4;
   int64          init_price = 5;
}

message TimeLock {
    message Token {
        string denom = 1;
        int64 amount = 2;
    }
    // 07921531
    bytes from = 1;
    string description = 2;
    repeated Token amount = 3;
    int64 lock_time = 4;
}

message TimeUnlock {
    // C4050C6C
    bytes from = 1;
    int64 time_lock_id = 2;
}

message TimeRelock {
    message Token {
        string denom = 1;
        int64 amount = 2;
    }
    // 504711DA
    bytes from = 1;
    int64 time_lock_id = 2;
    string description = 3;
    repeated Token amount = 4;
    int64 lock_time = 5;
}

message SetAccountFlag {
    // BEA6E301
    bytes from = 1;
    int64 flags =2;
}

message HashTimerLockTransferMsg {
    //
    bytes from = 1;
    bytes to = 2;
    string recipient_other_chain = 3;
    string sender_other_chain = 4;
    bytes random_number_hash = 5;
    int64 timestamp = 6;
    repeated Token amount = 7;
    string expected_income = 8;
    int64 height_span = 9;
    bool  cross_chain = 10;
}

message DepositHashTimerLockMsg {
    //
    bytes from = 1;
    repeated Token amount = 2;
    bytes swap_id = 3;
}

message ClaimHashTimerLockMsg {
    //
    bytes from = 1;
    bytes swap_id = 2;
    bytes random_number = 3;
}

message SubmitEvidenceMsg {
    // A38F1399
    bytes submitter = 1;
    repeated BscHeader headers = 2;
}

message BscHeader {
    bytes parentHash = 1;
    bytes sha3Uncles = 2;
    bytes miner = 3;
    bytes stateRoot = 4;
    bytes transactionsRoot = 5;
    bytes receiptsRoot = 6;
    bytes logsBloom = 7;
    int64 difficulty = 8;
    int64 number = 9;
    int64 gasLimit = 10;
    int64 gasUsed = 11;
    int64 timestamp = 12;
    bytes extraData = 13;
    bytes mixHash = 14;
    bytes nonce = 15;
}

message SideChainUnJailMsg {
    // 5681EC54
    bytes address = 1;
    string side_chain_id = 2;
}

message RefundHashTimerLockMsg {
    //
    bytes from = 1;
    bytes swap_id = 2;
}

message Status {
    int32 text = 1;
    string finalClaim = 2;
}

message Prophecy {
    string id = 1;
    Status status = 2;

    map<string, bytes> claimValidators = 3;
    map<string, string> validatorClaims = 4;
}

//mini token issue
message TinyTokenIssue {
    //    ED2832D4 // hardcoded, object type prefix in 4 bytes
    bytes  from = 1; // issue token owner
    string name = 2;
    string symbol = 3;
    int64  total_supply = 4;
    bool   mintable = 5;
    string token_uri = 6;
}

message MiniTokenIssue {
    //    A3F16C41 // hardcoded, object type prefix in 4 bytes
    bytes  from = 1; // issue token owner
    string name = 2;
    string symbol = 3;
    int64  total_supply = 4;
    bool   mintable = 5;
    string token_uri = 6;
}

message MiniTokenSetURI {
    //    7B1D34E7 // hardcoded, object type prefix in 4 bytes
    bytes  from = 1; // issue token owner
    string symbol = 2;
    string token_uri = 3;
}

message MiniTokenList {
    //    4C264019 // hardcoded, object type prefix in 4 bytes
    bytes   from  = 1;
    string  base_asset_symbol = 2;
    string  quote_asset_symbol = 3;
    int64   init_price = 4;
}

message TransferTokenOwnershipMsg {
    // 6d99d273
    bytes from = 1;
    string symbol = 2;
    bytes new_owner = 3;
}

message UnJailMsg {
    // 543AEC70
    bytes address = 1;
}