Skip to main content

Installation

Types

  • ebool: Encrypted bool
  • euint256: Encrypted uint256
  • eaddress: Encrypted address

Math operations

All arithmetic operations return an euint256. All binary operations may use either an euint256 or a regular uint256 as the first or second argument, or two euint256s. Bitwise operations work on both euint256 and ebool types, and may use either encrypted or plain values as arguments.

Comparison operations

Multiplexer

  • e.select(ebool, euint256, euint256) returns(euint256): Select between two euint256s based on an ebool condition
  • e.select(ebool, ebool, ebool) returns(ebool): Select between two ebools based on an ebool condition
  • e.select(ebool, eaddress, eaddress) returns(eaddress): Select between two eaddresses based on an ebool condition

Random Functions

All random functions require payment of the Inco fee.
  • e.rand() returns(euint256): Generate a random euint256 value
  • e.randBounded(uint256) returns(euint256): Generate a random euint256 value bounded by a uint256 upper limit
  • e.randBounded(euint256) returns(euint256): Generate a random euint256 value bounded by an euint256 upper limit

Inputs

  • e.asEuint256(uint256) returns(euint256): Convert a uint256 to an euint256 (trivial encrypt)
  • e.asEaddress(address) returns(eaddress): Convert an address to an eaddress (trivial encrypt)
  • e.newEuint256(bytes memory input) returns(euint256): Create a new euint256 from a ciphertext
  • e.newEbool(bytes memory input) returns(ebool): Create a new ebool from a ciphertext
  • e.newEaddress(bytes memory input) returns(eaddress): Create a new eaddress from a ciphertext

Type Casting

  • e.asEuint256(ebool) returns(euint256): Cast an ebool to an euint256

Access control

  • e.allow(euint256, address): Allow a user to access an euint256 value permanently
  • e.allow(ebool, address): Allow a user to access an ebool value permanently
  • e.allow(eaddress, address): Allow a user to access an eaddress value permanently
  • e.allowThis(euint256): Allow the current contract to access an euint256 value permanently
  • e.allowThis(ebool): Allow the current contract to access an ebool value permanently
  • e.allowThis(eaddress): Allow the current contract to access an eaddress value permanently
  • e.reveal(euint256): Make an euint256 value publicly accessible
  • e.reveal(ebool): Make an ebool value publicly accessible
  • e.reveal(eaddress): Make an eaddress value publicly accessible
  • e.isAllowed(address, euint256) returns(bool): Check if a user is allowed to access an euint256 value