Skip to main content

DeFi & Protocols

Nethereum provides typed, high-level services for interacting with major DeFi protocols and Ethereum ecosystem tools. Each integration wraps the protocol's smart contracts in a C# API — you get compile-time safety, automatic gas/nonce handling, and the same web3.Eth patterns used throughout Nethereum.

The Simple Path

TaskSimple Path
Access Uniswap V4web3.UniswapV4()
Quote a swap priceuniswap.Pricing.Quoter.QuoteExactInputQueryAsync(params)
Execute a swapuniswap.UniversalRouter.ExecuteRequestAndWaitForReceiptAsync(fn)
Manage liquidityuniswap.Positions.Manager.ModifyLiquiditiesRequestAndWaitForReceiptAsync(fn)
Execute through Safenew SafeAccount(safe, chainId, key) → any contract service auto-routes through Safe
Protect API with payments[X402PaymentRequired(amount: 1_000000)] on any ASP.NET endpoint
Pay for API accessnew X402Client(http, web3, key).GetAsync(url)
Query Circles balancenew GetTotalBalanceV2(client).SendRequestAsync(address)

For every row above, Nethereum handles gas estimation, nonce management, EIP-1559 fee calculation, and transaction signing automatically. You only override when you need to.

Protocol Packages

PackageProtocolWhat It Does
Nethereum.UniswapUniswap V2/V3/V4Token swaps, liquidity positions, price quoting, Permit2, Universal Router
Nethereum.GnosisSafeSafe (Gnosis Safe)Multi-signature transaction assembly, EIP-712 signing, SafeAccount, MultiSend
Nethereum.X402x402 ProtocolHTTP 402 payments with EIP-3009 USDC transfers, ASP.NET middleware, client library
Nethereum.CirclesCircles UBIBalance queries, personal minting, trust management, transaction history

Guides

GuideWhat You'll Learn
Uniswap: Swap TokensQuote prices, execute swaps via Universal Router, handle slippage and price impact
Uniswap: Manage LiquidityCreate/increase/decrease positions, collect fees, atomic rebalancing
Gnosis SafeBuild multi-sig transactions, collect signatures, SafeAccount, MultiSend
x402 PaymentsProtect API endpoints, accept USDC payments, EIP-3009 authorization flow
Circles UBIQuery balances, mint CRC, manage trust relationships on Gnosis Chain