Four data layers
Public market state
The program stores pools, slots, ticks, positions, pending swap outputs, administrative state, pause state, token eligibility, and position freezes in public mappings. These mappings are the shared ledger used by finalization. Public state includes:- Pool token identifiers, fee tier, and enabled state
- Current price, active liquidity, tick, fee growth, and protocol fees
- Initialized tick liquidity and linked-list pointers
- Position range, liquidity, fee checkpoints, and owed amounts, keyed by
token_id - Swap output and remaining original input, keyed by
swap_id, until claim - Administrative and control state
Private proof inputs
Leo inputs markedprivate are supplied to the proof without becoming ordinary public arguments. The core program uses private inputs for:
- The mint nonce
- The mint owner recipient and immutable withdrawal address
- Swap and claim blinding factors
- Mint, collect, and claim freezelist proofs
PositionNFT records to the prover when funding or authorizing an operation.
Encrypted records
Records carry confidential ownership and value. Record fields in this program do not declare explicit visibility, so their values are encrypted for the record owner. The core program returns:PositionNFTrecords to position owners- Dynamic token change records to token owners
- Token output and refund records to claim signers
- Token payout records to immutable position withdrawal addresses
- Compliance records to
SWAP_INVESTIGATOR_KEY
Public pseudonyms
Swaps use a publicblinded_address as both the stored caller and recipient. The confidential address is derived from the program address, a domain constant, the signer, and a private blinding factor.
The confidential address is a public, one-use execution pseudonym that omits the signer wallet from public swap fields while remaining bound to the signer and private factor for claims.
See Confidential addresses for the derivation and claim flow.
Participant and disclosure views
Different parties see different parts of the same operation.
The initial
DEPLOYER and SWAP_INVESTIGATOR_KEY constants contain the same address. That creates an initial overlap between administration and disclosure access. An admin transfer changes the admin mapping but does not change the hardcoded investigator key.
Trading path
A single-hop confidential swap follows this sequence:- The trader supplies a token record and a private blinding factor.
- The trader supplies public market parameters, including pool, direction, amount, limits, deadline, and token identifiers.
- The contract verifies the public confidential address against the program, signer, domain, and private factor.
- The token program transfers the input amount from a record into the AMM’s public balance.
- Finalization updates public pool and tick state and writes a public
SwapOutput. - The transition emits an encrypted
SwapComplianceRecordto the investigator key. - A later claim proves the same signer-bound confidential address and supplies the exact public output values.
- The token program creates token records for the signer.
- Finalization removes the pending
swap_outputsentry.
Position path
Position confidentiality uses records rather than swap-style confidential addresses.- Mint consumes two token records.
- The mint owner, immutable withdrawal address, and nonce are private inputs.
- The program computes a public
token_idfrom the public request, private owner, and private nonce. - Finalization creates public position accounting under that token ID.
- The owner receives an encrypted
PositionNFTthat binds the withdrawal address. - The investigator receives an encrypted
MintComplianceRecordcontaining token ID, nonce, signer, caller, owner, and withdrawal address. - Increase, decrease, and collect consume and reissue the PositionNFT while retaining the same token ID.
- Burn consumes the PositionNFT and removes the public position row after liquidity and owed balances reach zero.
burn does not return self.signer as a public output. The public token ID remains. Position activity is therefore linkable to one pseudonymous position identifier, but the burn output does not directly publish the wallet that signed it.
Compliance boundary
The program supplies selective-disclosure records and operational controls. Legal identity, jurisdiction, participant eligibility, disclosure authority, and retention remain off-chain responsibilities. Compliance records are created only for:mintswapswap_multi_hop