Interest Protocol
  • 👋Welcome to Interest Protocol
  • Overview
    • Sui💧
      • Contracts
        • Memez
        • Libs 📚
      • Suicoins
        • Swap
        • Dollar-Cost Averaging (DCA)
        • Airdrop
          • Suiplay Airdrop
        • Incinerator
        • Send
        • Merger
        • Suicoins Terminal
      • Memez.gg
        • Coins on Memez.GG
        • Memez.Fun
          • SDK
            • Pump API
            • Interfaces
          • Configuration
          • Migrators
          • Bonding Curve
          • Fees
      • IPX Coin Standard
    • Movement
      • Interest Protocol Decentralized Exchange (DEX)
        • Key Features
        • Core Innovations
      • sr-AMM
      • Token
        • Tokenomics
        • Utility
      • GTM
    • Audits
    • Security
    • Deprecated
      • Coin X Oracle 🔮
        • Pyth Network
        • Switchboard
      • Sui Tears 💧
        • Airdrop
          • Airdrop
          • Airdrop Utils
          • Linear Vesting Airdrop
        • Capabilities
          • Access Control
          • Owner
          • Quest
          • Timelock
        • Collections
          • Bitmap
          • Coin Decimals
        • DeFi
          • Oracle
          • Farm
          • Fund
          • Linear Vesting Wallet
          • Linear Clawback Vesting Wallet
          • Vesting
        • Governance
          • DAO
          • DAO Admin
          • DAO Treasury
        • Utils
          • ASCII
          • Comparator
          • Merkle Proof
          • Vectors
        • Math
          • Fixed Point 64
          • Fixed Point Roll
          • Fixed Point Wad
          • Int
          • Math64
          • Math128
          • Math256
      • CLAMM🐚
        • Hooks
      • Whitepapers
  • Glossary
Powered by GitBook
On this page
  • Result
  • Interface
  • eq
  • lt
  • gt
  • lte
  • gte
  • compare
  • compare_u8_vector

Was this helpful?

Export as PDF
  1. Overview
  2. Deprecated
  3. Sui Tears 💧
  4. Utils

Comparator

A library to compare structs. BCS uses little-endian encoding for all integer types, so results might be unexpected.

Result

  struct Result has drop {
    inner: u8,
  }
  • inner - It will hold one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

Interface

eq

It checks if the result of {compare} is EQUAL.

public fun eq(result: &Result): bool
  • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

  • @return bool. True if it is EQUAL

lt

It checks if the result of {compare} is SMALLER.

public fun lt(result: &Result): bool
  • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

  • @return bool. True if it is SMALLER

gt

It checks if the result of {compare} is GREATER.

public fun gt(result: &Result): bool
  • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

  • @return bool. True if it is GREATER

lte

It checks if the result of {compare} is SMALLER or EQUAL.

public fun lte(result: &Result): bool
  • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

  • @return bool. True if it is SMALLER or EQUAL.

gte

It checks if the result of {compare} is SMALLER or EQUAL.

public fun gte(result: &Result): bool
  • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

  • @return bool. True if it is SMALLER or EQUAL.

compare

Compares two structs of type T. Performs a comparison of two types after BCS serialization.

public fun compare<T>(left: &T, right: &T): Result
  • @param left: A struct of type T.

  • @param right: A struct of type T.

  • @return Result. A struct that contains the following values: {SMALLER}, {EQUAL} or {GREATER}.

compare_u8_vector

Compares two bytes.

public fun compare_u8_vector(left: vector<u8>, right: vector<u8>): Result
  • @param left: A set of bytes.

  • @param right: A set of bytes.

  • @return Result. A struct that contains the following values: {SMALLER}, {EQUAL} or {GREATER}.

PreviousASCIINextMerkle Proof

Last updated 1 year ago

Was this helpful?