Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
fd002be
add elgamal
andrew-fleming Jun 21, 2026
23b66e8
add compile crypto script
andrew-fleming Jun 21, 2026
916bc04
add crypto turbo task
andrew-fleming Jun 21, 2026
7d12f41
add changelog entry
andrew-fleming Jun 21, 2026
03f2537
add missing pure keyword in mock
andrew-fleming Jun 21, 2026
13379bf
remove runtime invariants tests
andrew-fleming Jun 21, 2026
6611d2c
fix task inputs arr
andrew-fleming Jun 21, 2026
bc57019
improve docs, disallow weak key in encryptPoint
andrew-fleming Jun 21, 2026
ac7e4da
add PR to changelog
andrew-fleming Jun 22, 2026
4f5cec8
disallow 0 as randomness in encryptPoint
andrew-fleming Jun 22, 2026
b1d1480
add missing pure keyword
andrew-fleming Jun 22, 2026
33148e1
improve docs
andrew-fleming Jun 22, 2026
11c5d04
add req sections
andrew-fleming Jun 22, 2026
baec069
Merge branch 'main' into add-elgamal
andrew-fleming Jun 23, 2026
7d11a2d
add cft
andrew-fleming Jun 25, 2026
7513743
Merge branch 'main' into add-elgamal
0xisk Jun 26, 2026
3586767
test(crypto): migrate ElGamal suite to async simulator
0xisk Jun 26, 2026
be7c465
Merge pull request #6 from 0xisk/test/migrate-elgamal-simulator
andrew-fleming Jun 26, 2026
9f80f4e
Merge branch 'main' into add-cft-2
andrew-fleming Jun 26, 2026
e5a8a6f
Merge branch 'add-elgamal' into add-cft-2
andrew-fleming Jun 26, 2026
6e526bb
update circuitInfo
andrew-fleming Jun 26, 2026
263de9f
use async/await in tests
andrew-fleming Jun 26, 2026
04a9f66
fix conflicts
andrew-fleming Jul 1, 2026
5e517a5
add spdx
andrew-fleming Jul 1, 2026
9a91c9d
improve balanceOf, add underflow checks, update circuitInfo
andrew-fleming Jul 2, 2026
c3b6608
add ecdhMask
andrew-fleming Jul 3, 2026
a22c899
Merge branch 'add-ecdhMask' into add-cft-2
andrew-fleming Jul 8, 2026
3999733
add feat
andrew-fleming Jul 9, 2026
6112c8d
update comments
andrew-fleming Jul 9, 2026
fa06f1a
fix approve
andrew-fleming Jul 9, 2026
b2e6515
fix mock and test separation: base & pub supply
andrew-fleming Jul 12, 2026
b06349c
rename modules, fix docs, add circuitInfo
andrew-fleming Jul 13, 2026
c925ee7
remove throwaway dir
andrew-fleming Jul 13, 2026
ae511c1
fix fmt
andrew-fleming Jul 13, 2026
c815361
Merge branch 'main' into add-cft-2
andrew-fleming Jul 13, 2026
6988217
fix conflicts
andrew-fleming Jul 14, 2026
28324c0
Merge branch 'add-cft-2' of https://github.com/andrew-fleming/compact…
andrew-fleming Jul 14, 2026
4c6f68a
add changelog
andrew-fleming Jul 14, 2026
55592a7
fix changelog entry
andrew-fleming Jul 14, 2026
fa00fc0
fix conflicts
andrew-fleming Jul 15, 2026
0d9848c
tidy up comments
andrew-fleming Jul 16, 2026
db5e2e7
deliver remaining allowance to the owner with escrow ownerMemo
andrew-fleming Jul 17, 2026
0677054
remove unneeded assert circuits
andrew-fleming Jul 17, 2026
3213368
doc self-transfer asymmetry in transfer and _move
andrew-fleming Jul 18, 2026
8c34bbd
drop the unused scalar-mul from the credit nonce encoding, update cir…
andrew-fleming Jul 18, 2026
f3b1c4f
add tests for ek/pk binding and zero approve paths
andrew-fleming Jul 18, 2026
c7ad04f
add _spendEscrow to the never-re-export list
andrew-fleming Jul 18, 2026
35785ce
remove stale pre-ECDH memo rec from test witnesses
andrew-fleming Jul 18, 2026
964c702
add escrow copy eq invariant test
andrew-fleming Jul 18, 2026
23c3d57
scope the _credit reused-seed claim to within a memo epoch
andrew-fleming Jul 18, 2026
0761cb5
fix test
andrew-fleming Jul 18, 2026
6c8ad14
remove the redundant escrow-map re-init in approve
andrew-fleming Jul 18, 2026
d033abe
update circuitInfo
andrew-fleming Jul 18, 2026
d73b0cb
bump timeout to 60
andrew-fleming Jul 18, 2026
1bc0d7e
fix spdx file name
andrew-fleming Jul 18, 2026
8b4eba8
fix param name in allowance
andrew-fleming Jul 18, 2026
866d5d9
improve docs
andrew-fleming Jul 18, 2026
77d5c06
Merge branch 'main' into add-cft-2
andrew-fleming Jul 18, 2026
5b645cc
fix lint
andrew-fleming Jul 18, 2026
5e5c844
refactor(token): drop Core suffix from the CFT module
0xisk Jul 20, 2026
a4f54e1
feat(token): add _mint/_burn/_burnFrom building blocks
0xisk Jul 20, 2026
af34ae9
feat(token): add ConfidentialFungibleTokenSupply extension
0xisk Jul 20, 2026
65dd9f0
refactor(token): move the composed CFT token to integration mocks
0xisk Jul 20, 2026
43a64b6
test(integration): add the CFT composition fixture
0xisk Jul 20, 2026
164aaf6
test(integration): add the CFT composition spec suite
0xisk Jul 20, 2026
815a161
test(integration): add CFT privacy and concurrency specs
0xisk Jul 20, 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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 30
timeout-minutes: 60

steps:
- name: Harden Runner
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add Confidential Fungible Token (#653)
- Add EcdhMask (#655)

### Changed
Expand Down
1,169 changes: 1,169 additions & 0 deletions contracts/src/token/ConfidentialFungibleToken.compact

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Compact Contracts v0.3.0-alpha (token/extensions/ConfidentialFungibleTokenSupply.compact)

pragma language_version >= 0.23.0;

/**
* @module ConfidentialFungibleTokenSupply
* @description Optional standalone extension that adds public supply
* accounting to a `ConfidentialFungibleToken`. It exposes the scalar
* `_addSupply` / `_subSupply` building blocks plus the `totalSupply` getter.
* It imports no token module.
*
* "Public" supply means the total, and therefore each mint/burn delta, is
* disclosed on chain. Balances stay confidential; only the aggregate is
* visible. This is the right default for issuers who must attest to a public
* circulating supply (stablecoins, tokenized funds). A confidential-supply
* extension (ElGamal supply cell + auditor viewing key) is a separate variant.
*
* @notice Pairs with `ConfidentialFungibleToken`. The consuming contract
* composes the pieces, calling the accounting block alongside the matching
* token op (the integration suite drives an assembled example,
* `test/integration/_mocks/ConfidentialFungibleTokenPublicSupply`):
*
* export circuit mint(account: Bytes<32>, value: Uint<128>): [] {
* Supply__addSupply(value);
* Token__mint(account, value);
* }
*
* The pairing is the consuming contract's responsibility: a token op called
* without its accounting block (or vice versa) breaks the
* `sum(balances) == totalSupply` invariant this extension exists to attest.
*/
module ConfidentialFungibleTokenSupply {
import CompactStandardLibrary;

// The public circulating supply. Mint and burn disclose their amounts
// through the delta on this value.
export ledger _totalSupply: Uint<128>;

/**
* @description Increases `totalSupply` by `value`. Call alongside the token
* module's `_mint`. The added amount is disclosed via the supply delta.
*
* Requirements:
*
* - `totalSupply + value` does not overflow `Uint<128>`.
*
* @param {Uint<128>} value - The amount added to the supply.
* @return {[]} - Empty tuple.
*/
export circuit _addSupply(value: Uint<128>): [] {
const MAX_UINT128 = 340282366920938463463374607431768211455;
assert(MAX_UINT128 - _totalSupply >= value,
"ConfidentialFungibleToken: overflow");
_totalSupply = disclose(_totalSupply + value as Uint<128>);
}

/**
* @description Decreases `totalSupply` by `value`. Call alongside the token
* module's `_burn` or `_burnFrom`. The removed amount is disclosed via the
* supply delta.
*
* Requirements:
*
* - `totalSupply` is at least `value`.
*
* @param {Uint<128>} value - The amount removed from the supply.
* @return {[]} - Empty tuple.
*/
export circuit _subSupply(value: Uint<128>): [] {
assert(_totalSupply >= value,
"ConfidentialFungibleToken: supply underflow");
_totalSupply = disclose(_totalSupply - value as Uint<128>);
}

/**
* @description Returns the public total token supply.
*
* @circuitInfo k=6, rows=26
*
* @return {Uint<128>} - The total supply.
*/
export circuit totalSupply(): Uint<128> {
return _totalSupply;
}
}
Loading