Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1f40012
Add authorized re-encryption of past transfers
eduv09 Apr 6, 2026
0d7b5cb
fix documentation, bug in _handleDecryption, and omit event in view k…
eduv09 Apr 7, 2026
e11c9c0
Add script to test decription and functionality on live network
eduv09 Apr 7, 2026
3b1bd3b
fix spelling
eduv09 Apr 8, 2026
3c26898
refactor Historic decryption and fix solidity pragma
eduv09 Apr 13, 2026
e64dae2
fix pragma solidity to be compatible with bite-solidity
eduv09 Apr 13, 2026
3ea309f
fix spelling and natSpec comments
eduv09 Apr 13, 2026
da20709
re-implement allways return true if not revert logic
eduv09 Apr 13, 2026
80419b3
Update contracts/HistoricView.sol Licence
eduv09 Apr 13, 2026
ea59465
move errors to contract, event emission to contract, and all event de…
eduv09 Apr 14, 2026
d9c95bf
address PR comments with bugfixes and style recomendations
eduv09 Apr 14, 2026
552926b
fix time range validation
eduv09 Apr 14, 2026
a955cac
fix lint issue
eduv09 Apr 14, 2026
d5954ee
fix increment of transferId
eduv09 Apr 14, 2026
2050616
add validation of plaintext arguments onDecrypt
eduv09 Apr 14, 2026
ad43afa
Style fixes, adjust allowed time ranges, and ad revoke function to in…
eduv09 Apr 16, 2026
c10cf98
fix lint
eduv09 Apr 16, 2026
5892111
fix logic in hadPermissions and remove unused lines
eduv09 Apr 17, 2026
ca619d1
refactor given feedback from confidential pay
eduv09 Apr 23, 2026
d0f1a17
Update README.md
eduv09 Apr 23, 2026
dcc8533
rename variable in CnfToken
eduv09 Apr 28, 2026
6d5f8f6
Update style in IConfidentialToken.sol
eduv09 Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Confidential Token implements privacy-preserving token functionality while maint
- **Minting Capability**: Optional minting functionality for managing token supply
- **Access Control**: OpenZeppelin AccessManager integration for fine-grained permissions
- **SKALE Integration**: Requires SKALE's precompiled contracts and BITE protocol for threshold encryption and secure computations.
- **Historic Transfer Decryption**: Token holders can grant viewers selective access to decrypt past transfers, either by time range or by specific transfer ID. To/From addresses involved in the transfer always have permission to request re-encryption of past transfers.
Comment thread
eduv09 marked this conversation as resolved.

## Core Contracts

Expand Down Expand Up @@ -54,6 +55,22 @@ The main contract implementing the confidential token functionality. It extends
- `encryptedBalanceOf(holder)`: Get the encrypted balance representation (must be decrypted off-chain)
- `ethBalanceOf(holder)`: Get the gas token balance for callback funding

**Historic Transfer Decryption:**

Every transfer emits an `EncryptedTransfer` event carrying the full transfer metadata (sender, recipient, value, timestamp, transfer ID) encrypted under the BITE Threshold Key. This payload can later be decrypted on-demand via the BITE callback mechanism.

Additionally, if the recipient has a registered public key at the time of transfer, a `TransferValueEncryptedForRecipient` event is emitted automatically in the same transaction — no extra request or fee required. The encrypted value in this event is ECIES-encrypted specifically for the recipient's public key, allowing them to read the transfer amount immediately.
Comment thread
eduv09 marked this conversation as resolved.

For third-party viewers (auditors, accounting tools, delegated observers), holders can grant selective decryption access to their own transfers:

- `requestDecryptHistoricTransfer(encryptedTransferData)`: Submit a TE-encrypted transfer payload for decryption. Requires the caller to be a registered user and have sufficient ETH balance for the callback fee. On successful callback, emits a `ReEncryptedTransfer` event with the value ECIES-encrypted for the requester's public key. The fee is charged even if the requester turns out not to be authorized — authorization is only checked inside the callback.
- `authorizeHistoricViewTimeRange(viewer, fromTimestamp, toTimestamp)`: Grant a viewer decryption access to all transfers whose timestamp falls strictly within `(fromTimestamp, toTimestamp)`. Setting `fromTimestamp >= toTimestamp` effectively disables the range. Emits `HistoricViewTimeRangeAuthorized`.
Comment thread
eduv09 marked this conversation as resolved.
Outdated
- `authorizeHistoricViewTransferId(viewer, transferId)`: Grant a viewer access to one specific transfer by its on-chain ID. The transfer ID must already exist. Emits `HistoricViewTransferIdAuthorized`.
- `removeHistoricViewTransferId(viewer, transferId)`: Revoke access to a single previously authorized transfer ID. Emits `HistoricViewTransferIdRevoked` only if the ID was present.
- `removeHistoricViewAuth(viewer)`: Revoke all historic view permissions for a viewer at once (both time range and all individual transfer IDs). Emits `HistoricViewPermissionsRevoked`.

> **Note:** The `from` and `to` parties of a transfer can always decrypt their own transfers without any explicit authorization.

**EIP-3009 Authorization Functions:**
- `transferWithAuthorization(from, to, value, validAfter, validBefore, nonce, signature)`: Transfer tokens using a signed authorization message.
- `receiveWithAuthorization(from, to, value, validAfter, validBefore, nonce, signature)`: Receive tokens via signed authorization.
Expand Down
2 changes: 1 addition & 1 deletion contracts/AccessManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with confidential-token. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity ^0.8.24;
pragma solidity ^0.8.27;

// It's used in the deploy script
// solhint-disable-next-line no-unused-import
Expand Down
Loading
Loading