Contracts

PrivacyPool

Core functions

solidity
function shield(ShieldParams calldata params, bytes calldata proof) external;
function spend(SpendParams calldata params, bytes calldata proof) external;

// Owner only
function whitelistToken(address token, bool allowed) external;
function pause() external;
function unpause() external;

ShieldParams

solidity
struct ShieldParams {
  address token;
  uint256 amount;
  bytes32 commitment;
}

SpendParams

solidity
struct SpendParams {
  address   token;
  bytes32   merkleRoot;
  bytes32[2] nullifiers;
  bytes32[2] newCommitments;
  uint256   amount;
  address   recipient;   // address(0) for private transfers
}

Events

solidity
event Shielded(address indexed token, bytes32 commitment, uint256 leafIndex, uint256 amount);
event Spent(bytes32[2] nullifiers, bytes32[2] newCommitments, address recipient);
When recipient is address(0), the spend is a private transfer — no tokens leave the pool, two new commitments are inserted instead.