Types
ebool: Encryptedbooleuint256: Encrypteduint256
Math operations
All these operations return aneuint256.
All binary operations may use either an euint256 or a regular uint256 as the first or second argument, or two euint256s
| 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 twoeuint256s based on aneboolconditione.select(ebool, ebool, ebool) returns(ebool): Select between twoebools on the firsteboolcondition
Inputs
e.asEuint256(uint256) returns(euint256): Convert auint256to aneuint256(trivial encrypt)e.asEbool(bool) returns(ebool): Convert aboolto anebool(trivial encrypt)e.newEuint256(bytes memory input) returns(euint256): Create a neweuint256from a ciphertexte.newEbool(bytes memory input) returns(ebool): Create a neweboolfrom 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 aneuint256e.requestDecryption(ebool value, bytes4 callbackSelector, bytes memory callbackData) returns (uint256 requestId): Request decryption of anebool