All projects

SettleKit

Agentic Cross-Chain Settlement SDK for DeFi

Risk & Compliance Tenderly

What it is

What it is
SettleKit is a TypeScript SDK that enables software agents to execute cross-chain financial flows as a single deterministic settlement pipeline. SettleKit Risk Guard is a verifiable risk and compliance layer for agentic cross-chain DeFi. The Risk Guard extension adds the safety infrastructure that makes autonomous execution trustworthy enough for production use.

The problem it solves
Modern DeFi requires users to manually bridge assets across chains, swap tokens, and deposit into liquidity pools across multiple interfaces. SettleKit abstracts this into a machine-to-machine financial pipeline — but agents executing financial flows autonomously have no safety net. There is no standard way to evaluate whether a settlement is safe before it executes, no verifiable record of the risk decisions made, and no mechanism to respond when market conditions deteriorate after capital is deployed. Without a compliance layer, agentic DeFi is too risky to run in production.

How it works
When a settlement intent is submitted — for example, bridge 5 USDC from Base Sepolia to Unichain Sepolia and deposit into a Uniswap v4 pool — the Execution Planner formats it into a settlement recipe and sends it to a Chainlink CRE Workflow before any execution begins. The workflow fans out to three data sources in parallel: Chainlink Data Feeds for verifiable oracle prices, the Uniswap v4 PoolManager for live pool liquidity depth, and the Circle CCTP API for bridge attestation status. It evaluates five risk checks — slippage, liquidity depth, bridge delay, price deviation, and oracle staleness — and emits a structured risk report with a verdict of APPROVED, WARNING, or BLOCKED. The Deterministic Executor only fires on APPROVED. Every settlement gets a public Risk Explorer URL showing the full execution trace, oracle data consumed, and a Tenderly Virtual TestNet explorer link proving the transaction ran.
Beyond single settlements, a second scheduled CRE Workflow runs every 24 hours to monitor active Uniswap v4 positions. If the current pool's liquidity falls below the required threshold, the system automatically identifies the deepest available alternative pool, executes the rebalance without user intervention, and immediately notifies the operator via Telegram. A Telegram bot serves as the human-in-the-loop interface — operators can simulate settlements, check status, toggle alerts, approve warnings, and view position health all from a single chat interface.

How it Works

Chainlink CRE serves as the sole risk orchestration layer. Two workflows are deployed: a trigger-based risk assessment workflow that fires on every incoming settlement intent, and a scheduled monitoring workflow that runs on a fixed 24-hour interval to scan active pool positions. Both workflows consume Chainlink Data Feeds for all price inputs — USDC/USD and ETH/USD — ensuring every risk decision is backed by a manipulation-resistant oracle rather than DEX spot prices alone. CRE's HTTP capability handles outbound calls to the Uniswap v4 PoolManager and Circle CCTP API. Note: Unichain Sepolia is not yet supported by CRE's native EVM capability, so pool health reads use CRE's HTTP capability with direct JSON-RPC calls to the Tenderly Virtual TestNet RPC as a documented workaround.

Tenderly Virtual TestNets fork Base Sepolia and Unichain Sepolia into isolated sandbox environments that mirror real testnet state. Every settlement execution runs against these forks, producing real transaction records with Tenderly explorer links that serve as the auditable proof of execution. Tenderly's Transaction Simulator is used within the CRE workflow to dry-run the pool deposit before committing, adding a fifth risk signal — whether the transaction would succeed or revert — without spending any gas.

SettleKit SDK handles the actual cross-chain execution. The bridge step moves USDC from Base Sepolia to Unichain Sepolia via Circle CCTP. The deposit step interacts directly with the Uniswap v4 PoolManager contract on Unichain Sepolia to add liquidity. viem handles all wallet and public client interactions. The executor is idempotent — it checks for existing positions before minting to avoid duplicate position errors.

The backend is a Node.js Express server with five endpoints — /trigger, /webhook, /settlement/:id, /positions, and /rebalance — and a SQLite store for persisting settlements, positions, and monitoring reports across sessions. The webhook endpoint receives CRE workflow output, updates settlement status, triggers execution on APPROVED reports, and fires Telegram alerts on WARNING or BLOCKED signals.

The Telegram bot is built on the Telegram Bot API and connects to the backend to provide real-time operator control. It handles both push notifications from the monitoring system and interactive commands from the operator, including a manual /rebalance fallback for when auto-rebalance fails.

The Risk Explorer is a frontend built on top of the existing SettleKit UI that gives every settlement a shareable public URL displaying the full execution trace, Chainlink oracle data consumed, each risk check result, and the Tenderly transaction link.

Links

Created by

  • winverse