Shielded Swap
Function Signature
function shieldedSwap(
ShieldedSwapParams calldata params,
bytes calldata proof
) external nonReentrantParameters Struct
struct ShieldedSwapParams {
bytes32[6] noteNullifiers;
bytes32 txNullifier;
bytes32 root;
bytes32 noteChangeCommitment;
bytes32 noteFeeChangeCommitment;
bytes32 selector; // Uniswap function selector
SwapRouterArgs routerArgs;
bytes32 receivingKeyCommitment; // Owner commitment for output note
bytes32[9] ciphertextChange;
bytes32[9] ciphertextFeeChange;
bytes32[6] ciphertextSwap; // Half-encrypted swap output
GasFee gasFee;
bytes32 nullifiersHash;
bytes32 fee;
bytes32 feeTokenAddress;
}
struct SwapRouterArgs {
bytes32 amountIn;
bytes32 amountOutMin;
bytes32[4] path; // Token addresses (max 4)
bytes32 pathLength;
bytes32 deadline;
}Execution Steps
Swap Execution
Selector
Function
Fee-on-Transfer Variant
Output Note Computation
Last updated