Skip to main content

Uniswap v4 Integration - Sepolia Deployment

Overview

JACK has successfully integrated with Uniswap v4 hooks on Sepolia testnet, enabling policy-based settlement with slippage protection and intent validation.

Deployed Contracts

JACKPolicyHook

The JACKPolicyHook contract enforces policy guardrails at settlement time, validating slippage bounds and intent deadlines before allowing swaps to execute.

Key Features

  • Policy Registration: Owners can register policies with minimum amount out, deadline, and slippage bounds
  • Policy Validation: Automatically validates policies during swap execution via beforeSwap hook
  • Slippage Protection: Enforces maximum slippage percentage on quoted amounts
  • Deadline Enforcement: Rejects expired intents based on policy deadline
  • Updatable Policies: Policy updaters can adjust bounds without full re-registration

Contract Interface

// Register a policy for an intent
function setPolicy(
bytes32 intentId,
uint256 minAmountOut,
uint256 deadline,
address updater
) external onlyOwner;

// Register a policy with slippage bounds
function setPolicyWithSlippage(
bytes32 intentId,
uint256 minAmountOut,
uint256 referenceAmountOut,
uint16 maxSlippageBps,
uint256 deadline,
address updater
) external onlyOwner;

// Check if a policy allows a quoted amount
function checkPolicy(
bytes32 intentId,
uint256 quotedAmountOut
) external view returns (bool allowed, bytes32 reason);

JACKSettlementAdapter

The JACKSettlementAdapter contract integrates with Uniswap v4's unlock/callback pattern to execute settlements with policy validation.

Key Features

  • Intent Validation: Validates intent signatures using EIP-712
  • Policy Enforcement: Checks policy compliance before executing swaps
  • Solver Authorization: Only authorized solvers can settle intents
  • Unlock/Callback Pattern: Integrates with Uniswap v4 PoolManager for atomic settlement
  • Delta Settlement: Handles positive and negative deltas for both currencies

Contract Interface

// Settle an intent via Uniswap v4
function settleIntent(
Intent calldata intent,
PoolKey calldata poolKey,
SwapParams calldata swapParams,
uint256 quotedAmountOut
) external nonReentrant onlySolver;

// Authorize a solver
function setAuthorizedSolver(
address solver,
bool authorized
) external onlyOwner;

Integration Details

Uniswap v4 PoolManager

The contracts integrate with the official Uniswap v4 PoolManager on Sepolia:

Hook Address Mining

The JACKPolicyHook was deployed using CREATE2 with address mining to ensure the hook address has the correct flags:

  • CREATE2 Salt: 23048
  • Hook Flags: beforeSwap (bit 7 set to 1)
  • Mining Library: HookMiner from v4-periphery

This ensures the PoolManager recognizes the hook's permissions and calls beforeSwap during swap execution.

Usage Examples

Register a Policy

import { createPublicClient, createWalletClient, http } from 'viem';
import { sepolia } from 'viem/chains';

const policyHookAddress = '0xE8142B1Ff0DA631866fec5771f4291CbCe718080';

// Register a policy for an intent
const txHash = await walletClient.writeContract({
address: policyHookAddress,
abi: policyHookAbi,
functionName: 'setPolicy',
args: [
intentId, // bytes32
minAmountOut, // uint256
deadline, // uint256
updaterAddress // address
]
});

Settle an Intent

const settlementAdapterAddress = '0xd8f0415b488F2BA18EF14F5C41989EEf90E51D1A';

// Settle an intent via Uniswap v4
const txHash = await walletClient.writeContract({
address: settlementAdapterAddress,
abi: settlementAdapterAbi,
functionName: 'settleIntent',
args: [
intent, // Intent struct
poolKey, // PoolKey struct
swapParams, // SwapParams struct
quotedAmountOut // uint256
]
});

Testing on Sepolia

Prerequisites

  1. Sepolia ETH for gas fees
  2. Test tokens for swaps
  3. RPC URL (Infura, Alchemy, or public RPC)

Faucets

Read Contract State

# Check policy hook owner
cast call 0xE8142B1Ff0DA631866fec5771f4291CbCe718080 \
"owner()(address)" \
--rpc-url https://sepolia.infura.io/v3/YOUR_KEY

# Check if a policy exists
cast call 0xE8142B1Ff0DA631866fec5771f4291CbCe718080 \
"checkPolicy(bytes32,uint256)(bool,bytes32)" \
<INTENT_ID> <QUOTED_AMOUNT> \
--rpc-url https://sepolia.infura.io/v3/YOUR_KEY

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ JACK SDK │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Intent │ │ V4 │ │ Yellow │ │
│ │ Manager │ │ Provider │ │ Provider │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────┐
│ Sepolia Testnet │
│ ┌──────────────────────┐ ┌──────────────────────┐ │
│ │ JACKPolicyHook │ │ JACKSettlementAdapter│ │
│ │ 0xE814...8080 │ │ 0xd8f0...1D1A │ │
│ └──────────────────────┘ └──────────────────────┘ │
│ │ │ │
│ └────────────┬───────────┘ │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ Uniswap v4 Pool │ │
│ │ Manager │ │
│ │ 0xE03A...3543 │ │
│ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Prize Track Submission

This deployment satisfies the requirements for the Uniswap Foundation Prize Track:

Requirements Met

  • Contracts Deployed: Both contracts deployed to Sepolia testnet
  • Transaction Hashes: Captured and documented
  • Contract Verification: Verified on Sourcify (Etherscan compatible)
  • Functional Code: Demonstrates v4 hooks integration with policy enforcement
  • Repository: Public GitHub repository with complete source code
  • Documentation: Comprehensive documentation and setup instructions

Submission Details

  • Track: Uniswap Foundation Prize Track
  • Categories: Agentic Finance, Privacy DeFi
  • Repository: [GitHub Link]
  • Demo Video: [Video Link] (max 3 minutes)

Next Steps

  1. SDK Integration: Integrate deployed contracts with JACK SDK
  2. Integration Tests: Run end-to-end tests on Sepolia
  3. Demo Video: Record demonstration of policy enforcement and settlement
  4. Yellow Network Integration: Complete Yellow SDK integration for off-chain transactions
  5. Prize Track Submission: Submit to ETHGlobal with all required materials

Support

For questions or issues:


Last Updated: February 8, 2026
Deployment Status: ✅ Live on Sepolia
Verification Status: ✅ Verified on Sourcify