Reference
Library Reference
All functions exposed by the Inco library
Types
ebool
: Encryptedbool
euint256
: Encrypteduint256
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 euint256
s
Name | Function | Type |
---|---|---|
Addition | e.add | Binary |
Subtraction | e.sub | Binary |
Multiplication | e.mul | Binary |
Division | e.div | Binary |
Remainder | e.rem | Binary |
BitAnd | e.and | Binary |
BitOr | e.or | Binary |
BitXor | e.xor | Binary |
Shift Right | e.shr | Binary |
Shift Left | e.shl | Binary |
Rotate Right | e.rotr | Binary |
Rotate Left | e.rotl | Binary |
Comparison operations
Name | Function | Type | Returns |
---|---|---|---|
Equal | e.eq | Binary | ebool |
Not equal | e.ne | Binary | ebool |
Greater than or equal | e.ge | Binary | ebool |
Greater than | e.gt | Binary | ebool |
Less than or equal | e.le | Binary | ebool |
Less than | e.lt | Binary | ebool |
Min | e.min | Binary | euint256 |
Max | e.max | Binary | euint256 |
Not | e.not | Unary | ebool |
Multiplexer
e.select(ebool, euint256, euint256) returns(euint256)
: Select between twoeuint256
s based on anebool
conditione.select(ebool, ebool, ebool) returns(ebool)
: Select between twoebool
s on the firstebool
condition
Inputs
e.asEuint256(uint256) returns(euint256)
: Convert auint256
to aneuint256
(trivial encrypt)e.asEbool(bool) returns(ebool)
: Convert abool
to anebool
(trivial encrypt)e.newEuint256(bytes memory input) returns(euint256)
: Create a neweuint256
from a ciphertexte.newEbool(bytes memory input) returns(ebool)
: Create a newebool
from a ciphertext
Access control
e.allow(address)
: Allow a user to access the value permanentlye.allowThis()
: Allow the current contract to access the value permanentlye.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 aneuint256
e.requestDecryption(ebool value, bytes4 callbackSelector, bytes memory callbackData) returns (uint256 requestId)
: Request decryption of anebool
Decryption callback format
Was this page helpful?