Types

The provided Solidity code defines several struct types, each serving a specific purpose within a smart contract or a system

1. Dec:

struct Dec {
    uint256 value;
    uint8 precision;
}
  • Description: Represents a fixed point decimal value, stored as an integer multiplied by 10^precision to obtain the actual value.

  • Properties:

    • value: Unsigned integer storing the value.

    • precision: Unsigned integer of 8 bits (uint8) representing the precision.

    • Unsigned integer of 8 bits (uint8) representing the precision.

2. Coin

struct Coin {
    string denom;
    uint256 amount;
}
  • Description: Represents a token with a denomination and an amount.

  • Properties:

    • denom: String representing the denomination of the token.

    • amount: Unsigned integer storing the token's amount.

3. DecCoin

struct DecCoin {
    string denom;
    uint256 amount;
    uint8 precision;
}
  • Description: Represents a token with a denomination, an amount, and a precision.

  • Properties:

    • denom: String representing the denomination of the token.

    • amount: Unsigned integer storing the token's amount.

    • precision: Unsigned integer of 8 bits (uint8) representing the precision of the token amount.

4. PageResponse

struct PageResponse {
    bytes nextKey;
    uint64 total;
}
  • Description: Represents a page response.

  • Properties:

    • nextKey: Bytes representing the next key for pagination.

    • total: Unsigned integer (uint64) representing the total count.

5.Page Request

struct PageRequest {
    bytes key;
    uint64 offset;
    uint64 limit;
    bool countTotal;
    bool reverse;
}
  • Description: Represents a page request for pagination purposes.

  • Properties:

    • key: Bytes representing the key for pagination.

    • offset: Unsigned integer (uint64) specifying the offset for pagination.

    • limit: Unsigned integer (uint64) specifying the limit for pagination.

    • countTotal: Boolean indicating whether total count should be calculated.

    • reverse: Boolean indicating whether the pagination should be in reverse order.

6. Height

struct Height {
    // the revision that the client is currently on
    uint64 revisionNumber;
    // the height within the given revision
    uint64 revisionHeight;
}
  • Description: Represents a monotonically increasing data type used for comparison and updating/freezing clients.

  • Properties:

    • revisionNumber: Unsigned integer (uint64) representing the revision the client is currently on.

    • revisionHeight: Unsigned integer (uint64) representing the height within the given revision.

Last updated