Utils

The following documentation provides context, reasoning, and examples of modules found in the Utils directory.

Utils

The Utils module provides miscellaneous circuits and common utilities for Compact contract development.

Usage

// UtilsExample.compact

pragma language_version >= 0.16.0;

import CompactStandardLibrary;
import './node_modules/@openzeppelin-compact/contracts/src/utils/Utils';

export circuit performActionWhenEqual(
  a: Either<ZswapCoinPublicKey, ContractAddress>,
  b: Either<ZswapCoinPublicKey, ContractAddress>,
): [] {
  const isEqual = Utils_isKeyOrAddressEqual(a, b);
  if (isEqual) {
    // Do something
  } else {
    // Do something else
  }
}