Types

  • ebool: Encrypted bool
  • euint256: Encrypted uint256

Math operations

All these 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

NameFunctionType
Additione.addBinary
Subtractione.subBinary
Multiplicatione.mulBinary
Divisione.divBinary
Remaindere.remBinary
BitAnde.andBinary
BitOre.orBinary
BitXore.xorBinary
Shift Righte.shrBinary
Shift Lefte.shlBinary
Rotate Righte.rotrBinary
Rotate Lefte.rotlBinary

Comparison operations

NameFunctionTypeReturns
Equale.eqBinaryebool
Not equale.neBinaryebool
Greater than or equale.geBinaryebool
Greater thane.gtBinaryebool
Less than or equale.leBinaryebool
Less thane.ltBinaryebool
Mine.minBinaryeuint256
Maxe.maxBinaryeuint256
Note.notUnaryebool

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 on the first ebool condition

Inputs

  • e.asEuint256(uint256) returns(euint256): Convert a uint256 to an euint256 (trivial encrypt)
  • e.asEbool(bool) returns(ebool): Convert a bool to an ebool (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

Access control

  • e.allow(address): Allow a user to access the value permanently
  • e.allowThis() : Allow the current contract to access the value permanently
  • e.isAllowed(address, e-value) returns(bool) : Check if a user is allowed to access the value (transient or permanent)

Decryption request

  • e.requestDecryption(euint256 value, bytes4 callbackSelector, bytes memory callbackData) returns (uint256 requestId): Request decryption of an euint256
  • e.requestDecryption(ebool value, bytes4 callbackSelector, bytes memory callbackData) returns (uint256 requestId): Request decryption of an ebool

Decryption callback format

function callback(
        uint256 requestId,
        uint256 result,
        bytes memory data
    ) external {
        // code
    }