Store

Defines the way in which the state of the House is being stored in the chain.

Deposit

The Deposit message is used to store the data of a particular deposition in the blockchain. The deposit is allowed on the markets that are in Active status. The deposit entity consists of the following fields:

  1. creator: The address of the deposit message creator account.

  2. depositor_address: The address of the depositor.

  3. market_uid: It is the unique identifier of a market.

  4. participation_index: The index of the participation of the market.

  5. amount: The amount of the deposit.

  6. fee: The amount of paid fee for the deposition.

  7. liquidity: The amount of available liquid amount for participation (amount - fee).

  8. withdraw_count: The count of withdrawals on a deposit.

  9. total_withdraw_amount: The total amount of withdrawal value till now.

The proto for the Deposit messages is as follows:

// Deposit represents the deposit against a market held by an account.
message Deposit {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;
  option (gogoproto.goproto_stringer) = false;

  // creator is the bech32-encoded address of the depositor.
  string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];

  // creator is the bech32-encoded address of the depositor.
  string depositor_address = 2
      [ (gogoproto.moretags) = "yaml:\"depositor_address\"" ];

  // market_uid is the uid of market/order book against which deposit is being
  // made.
  string market_uid = 3 [
    (gogoproto.customname) = "MarketUID",
    (gogoproto.jsontag) = "market_uid",
    json_name = "market_uid"
  ];

  // participation_index is the index corresponding to the order book
  // participation
  uint64 participation_index = 4
      [ (gogoproto.moretags) = "yaml:\"participation_index\"" ];

  // amount is the amount being deposited on an order book to be a house
  string amount = 5 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
    (gogoproto.nullable) = false,
    (gogoproto.moretags) = "yaml:\"amount\""
  ];

  // withdrawal_count is the total count of the withdrawals from an order book
  uint64 withdrawal_count = 6 [ (gogoproto.moretags) = "yaml:\"withdrawals\"" ];

  // total_withdrawal_amount is the total amount withdrawn from the liquidity
  // provided
  string total_withdrawal_amount = 7 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
    (gogoproto.nullable) = false,
    (gogoproto.moretags) = "yaml:\"total_withdrawal_amount\""
  ];
}

Withdraw

The Withdraw message is used to store the data of a particular withdrawal in the blockchain. The withdraw entity consists of the following fields:

  1. creator: The withdrawal message creator address.

  2. id: The sequential ID of withdrawal generated by the blockchain.

  3. address: The address of the depositor account.

  4. market_uid: It is the unique identifier of a market.

  5. participation_index: The index of the participants created when deposited.

  6. mode: The mode of withdrawal.

  7. amount: The amount of withdrawal.

The proto for the withdrawal messages is as follows:

// Withdrawal represents the withdrawal against a deposit.
message Withdrawal {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;
  option (gogoproto.goproto_stringer) = false;

  // creator is the bech32-encoded address of the depositor.
  string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];

  // withdrawal is the withdrawal attempt id.
  uint64 id = 2 [
    (gogoproto.customname) = "ID",
    (gogoproto.jsontag) = "id",
    json_name = "id",
    (gogoproto.moretags) = "yaml:\"id\""
  ];

  // address is the bech32-encoded address of the depositor.
  string address = 3 [ (gogoproto.moretags) = "yaml:\"address\"" ];

  // market_uid is the uid of market against which the deposit is
  // being made.
  string market_uid = 4 [
    (gogoproto.customname) = "MarketUID",
    (gogoproto.jsontag) = "market_uid",
    json_name = "market_uid"
  ];

  // participation_index is the id corresponding to the book participation
  uint64 participation_index = 5
      [ (gogoproto.moretags) = "yaml:\"participation_index\"" ];

  // mode is the withdrawal mode enum value
  WithdrawalMode mode = 6 [ (gogoproto.moretags) = "yaml:\"mode\"" ];

  // amount is the amount being withdrawn.
  string amount = 7 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
    (gogoproto.nullable) = false,
    (gogoproto.moretags) = "yaml:\"amount\""
  ];
}

Enums

// WithdrawalMode is the enum type for the withdrawal mode.
enum WithdrawalMode {
  // invalid
  WITHDRAWAL_MODE_UNSPECIFIED = 0;
  // full
  WITHDRAWAL_MODE_FULL = 1;
  // partial
  WITHDRAWAL_MODE_PARTIAL = 2;
}

Last updated